Helius
2021-06-16 4e51778362c2130598a4c73ec4cebe6629dbc53f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?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>