DictDataMapper.xml
5.51 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?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.pc.system.dict.mapper.DictDataMapper">
<resultMap type="com.huaheng.pc.system.dict.domain.DictData" id="DictDataResult">
<id property="id" column="id" />
<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="enable" column="enable" />
<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 id, dictSort, dictLabel, dictValue, dictType, cssClass, listClass, isDefault, enable, createBy, createTime, remark from sys_dict_data
</sql>
<select id="selectDictDataList" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="warehouseId != null">
AND warehouseId = #{warehouseId}
</if>
<if test="dictType != null and dictType != ''">
AND dictType = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dictLabel like concat('%', #{dictLabel}, '%')
</if>
<if test="enable != null">
AND enable = #{enable}
</if>
</where>
</select>
<select id="selectDictDataByType" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
where warehouseId = #{warehouseId} AND dictType = #{dictType} AND enable=true order by dictSort asc
</select>
<select id="selectDictLabel" resultType="String">
select dictLabel from sys_dict_data
where warehouseId = #{warehouseId} AND dictType = #{dictType} and dictValue = #{dictValue}
</select>
<select id="selectDictDataById" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
where warehouseId = #{warehouseId} AND id = #{id}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where warehouseId = #{warehouseId} AND dictType=#{dictType}
</select>
<select id="checkConfig" resultType="java.lang.Integer">
select id from sys_dict_data
<where>
<if test="warehouseId != null">
AND warehouseId = #{warehouseId}
</if>
<if test="dictType != null">
AND dictType = #{dictType}
</if>
<if test="dictValue != null">
AND dictValue = #{dictValue}
</if>
</where>
</select>
<delete id="deleteDictDataById">
delete from sys_dict_data where warehouseId = #{warehouseId} AND id = #{id}
</delete>
<delete id="deleteDictDataByIds">
delete from sys_dict_data where warehouseId = #{warehouseId} AND id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateDictData">
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="enable != null">enable = #{enable},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if>
updateTime = sysdate()
</set>
where warehouseId = #{warehouseId} AND id = #{id}
</update>
<update id="updateDictDataType">
update sys_dict_data set dictType = #{newDictType} where dictType = #{oldDictType}
</update>
<insert id="insertDictData">
insert into sys_dict_data(
<if test="warehouseId != null">warehouseId,</if>
<if test="warehouseCode != null">warehouseCode,</if>
<if test="dictSort != null">dictSort,</if>
<if test="dictLabel != null">dictLabel,</if>
<if test="dictValue != null">dictValue,</if>
<if test="dictType != null">dictType,</if>
<if test="cssClass != null ">cssClass,</if>
<if test="listClass != null">listClass,</if>
<if test="isDefault != null">isDefault,</if>
<if test="enable != null">enable,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">createBy,</if>
createTime
)values(
<if test="warehouseId != null">#{warehouseId},</if>
<if test="warehouseCode != null">#{warehouseCode},</if>
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null">#{dictLabel},</if>
<if test="dictValue != null">#{dictValue},</if>
<if test="dictType != null">#{dictType},</if>
<if test="cssClass != null">#{cssClass},</if>
<if test="listClass != null">#{listClass},</if>
<if test="isDefault != null">#{isDefault},</if>
<if test="enable != null">#{enable},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
sysdate()
)
</insert>
</mapper>