heheng
6 天以前 d8012ee77b6a9e86611aae9074d5925826f4210d
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
<?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.gkhy.exam.system.mapper.SysDictDataMapper">
    <resultMap type="com.gkhy.exam.common.domain.entity.SysDictData" id="SysDictDataResult">
        <id     property="id"   column="id"   />
        <result property="sort"   column="sort"   />
        <result property="label"  column="label"  />
        <result property="value"  column="value"  />
        <result property="dictType"   column="dict_type"   />
        <result property="cssClass"   column="css_class"   />
        <result property="listClass"  column="list_class"  />
        <result property="isDefault"  column="is_default"  />
        <result property="status"     column="status"      />
        <result property="createBy"   column="create_by"   />
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
        <result property="remark" column="remark" />
    </resultMap>
 
    <sql id="selectDictDataVo">
        select id, sort, label, value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
        from sys_dict_data
    </sql>
 
 
    <select id="selectDictDataList"  resultMap="SysDictDataResult">
        <include refid="selectDictDataVo"/>
        <where>
            <if test="dictType != null and dictType != ''">
                AND dict_type = #{dictType}
            </if>
            <if test="label != null and label != ''">
                AND label like concat('%', #{label}, '%')
            </if>
            <if test="status != null and status != ''">
                AND status = #{status}
            </if>
        </where>
        order by sort asc
    </select>
 
    <select id="selectDictDataByType"  resultMap="SysDictDataResult">
        <include refid="selectDictDataVo"/>
        where status = 0 and dict_type = #{dictType} order by sort asc
    </select>
 
    <select id="countDictDataByType" resultType="Integer">
        select count(1) from sys_dict_data where dict_type=#{dictType}
    </select>
 
    <update id="updateDictDataType" parameterType="String">
        update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
    </update>
 
    <select id="selectDictLabel" resultType="String">
        select label from sys_dict_data
        where dict_type = #{dictType} and value = #{dictValue}
    </select>
</mapper>