DictDataMapper.xml
5.14 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?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.huaheng.project.system.dict.mapper.DictDataMapper">
<resultMap type="DictData" id="DictDataResult">
<id property="dictCode" column="dictCode" />
<result property="dictSort" column="dictSort" />
<result property="dictLabel" column="dictLabel" />
<result property="dictValue" column="dictValue" />
<result property="dictType" column="dictType" />
<result property="cssClass" column="cssClass" />
<result property="listClass" column="listClass" />
<result property="isDefault" column="isDefault" />
<result property="status" column="status" />
<result property="createBy" column="createBy" />
<result property="createTime" column="createTime" />
<result property="updateBy" column="updateBy" />
<result property="updateTime" column="updateTime" />
</resultMap>
<sql id="selectDictDataVo">
select dictCode, dictSort, dictLabel, dictValue, dictType, cssClass, listClass, isDefault, status, createBy, createTime, remark from sys_dict_data
</sql>
<select id="selectDictDataList" parameterType="DictData" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="dictType != null and dictType != ''">
AND dictType = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dictLabel like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
</select>
<select id="selectDictDataByType" parameterType="DictData" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
where dictType = #{dictType} order by dictSort asc
</select>
<select id="selectDictLabel" resultType="String">
select dictLabel from sys_dict_data
where dictType = #{dictType} and dictValue = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
where dictCode = #{dictCode}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dictType=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dictCode = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="String">
delete from sys_dict_data where dictCode in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
<update id="updateDictData" parameterType="DictData">
update sys_dict_data
<set>
<if test="dictSort != null and dictSort != ''">dictSort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dictLabel = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dictValue = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dictType = #{dictType},</if>
<if test="cssClass != null and cssClass != ''">cssClass = #{cssClass},</if>
<if test="listClass != null and listClass != ''">listClass = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">isDefault = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if>
updateTime = sysdate()
</set>
where dictCode = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dictType = #{newDictType} where dictType = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="DictData">
insert into sys_dict_data(
<if test="dictSort != null and dictSort != ''">dictSort,</if>
<if test="dictLabel != null and dictLabel != ''">dictLabel,</if>
<if test="dictValue != null and dictValue != ''">dictValue,</if>
<if test="dictType != null and dictType != ''">dictType,</if>
<if test="cssClass != null and cssClass != ''">cssClass,</if>
<if test="listClass != null and listClass != ''">listClass,</if>
<if test="isDefault != null and isDefault != ''">isDefault,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">createBy,</if>
createTime
)values(
<if test="dictSort != null and dictSort != ''">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>