<?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.xzx.gc.role.mapper.CoreDictMapper"> 
 | 
    <select id="findAllList"  resultType="com.xzx.gc.entity.CoreDict"> 
 | 
        select * from core_dict where del_flag = 0 
 | 
        <if test="type != null and type != ''"> 
 | 
            and  type = #{type} 
 | 
        </if> 
 | 
        ORDER BY type, sort DESC 
 | 
    </select> 
 | 
    <select id="findTypeList"  resultType="java.util.Map"> 
 | 
        SELECT 
 | 
           DISTINCT (type),type_name 
 | 
        FROM core_dict 
 | 
        WHERE del_flag = #{delFlag} 
 | 
        ORDER BY type 
 | 
    </select> 
 | 
    <select id="findNameByType"  resultType="java.lang.String"> 
 | 
        SELECT 
 | 
           name 
 | 
        FROM core_dict 
 | 
        WHERE value = #{value} 
 | 
        limit 1 
 | 
    </select> 
 | 
    <select id="findChildByParent"  resultType="com.xzx.gc.entity.CoreDict"> 
 | 
         SELECT 
 | 
            * 
 | 
        FROM core_dict 
 | 
        WHERE 
 | 
        parent = #{id} and del_flag = 0 order by sort DESC 
 | 
    </select> 
 | 
    <update id="bathDelByValue" parameterType="java.util.List"> 
 | 
        update core_dict set del_flag =1 where value in 
 | 
        <foreach collection="values" index="index" item="value" open="(" separator="," close=")"> 
 | 
            #{value} 
 | 
        </foreach> 
 | 
    </update> 
 | 
    <select id="queryByCondition" resultType="com.xzx.gc.entity.CoreDict"> 
 | 
        select 
 | 
        t.* 
 | 
        from core_dict t 
 | 
        where del_flag=0 
 | 
        <if test="value != null"> 
 | 
            and  t.VALUE like concat("%",#{value},"%") 
 | 
        </if> 
 | 
        <if test="name != null"> 
 | 
            and  t.NAME like concat("%",#{name},"%") 
 | 
        </if> 
 | 
        <if test="type != null"> 
 | 
            and  t.type=#{type} 
 | 
        </if> 
 | 
        <if test="typeName != null"> 
 | 
            and  t.TYPE_NAME like concat("%",#{typeName},"%") 
 | 
        </if> 
 | 
        <if test="parent != null"> 
 | 
            and  t.PARENT like concat("%",#{parent},"%") 
 | 
        </if> 
 | 
        order by id  desc 
 | 
    </select> 
 | 
</mapper> 
 | 
  
 | 
    
 |