<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.unis.crk.basic.mapper.BasicEnumMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.unis.crk.basic.entity.BasicEnum">
        <id column="enumId" property="enumId" />
        <result column="enumCode" property="enumCode" />
        <result column="enumName" property="enumName" />
        <result column="gbCode" property="gbCode" />
        <result column="parentId" property="parentId" />
        <!--result column="ENUM_ROOT_ID" property="enumRootId" />-->
        <result column="createDate" property="createDate" />
        <result column="REMARK" property="remark" />
        <result column="delFlag" property="delFlag" />
    <!--    <result column="CREARER" property="crearer" />-->
        <result column="updatetime" property="updatetime" />
    </resultMap>

    <insert id="importData" parameterType="java.util.Map">
      INSERT INTO basic_enum (createDate, delFlag, parentId, enumCode, enumName, gbCode, remark) VALUES
      ${sql}
  </insert>



    <select id="getAllParen" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        SELECT * FROM basic_enum WHERE parentId IS NULL OR parentId = ''  OR parentId = '0'
    </select>
    <select id="getCountChildren" resultType="Integer" parameterType="java.lang.String">
        SELECT COUNT(*) FROM basic_enum WHERE  parentId=#{enumId}
    </select>

</mapper>
