blob: 3b94b7fb0c96f34a81eb3190864b4b839d1eb688 [file] [log] [blame]
86133aaa3f5d2025-04-20 21:33:29 +08001<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE mapper
3PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5<mapper namespace="com.ruoyi.system.mapper.SysDictDataMapper">
6
7 <resultMap type="SysDictData" id="SysDictDataResult">
8 <id property="dictCode" column="dict_code" />
9 <result property="dictSort" column="dict_sort" />
10 <result property="dictLabel" column="dict_label" />
11 <result property="dictValue" column="dict_value" />
12 <result property="dictType" column="dict_type" />
13 <result property="cssClass" column="css_class" />
14 <result property="listClass" column="list_class" />
15 <result property="isDefault" column="is_default" />
16 <result property="status" column="status" />
17 <result property="createBy" column="create_by" />
18 <result property="createTime" column="create_time" />
19 <result property="updateBy" column="update_by" />
20 <result property="updateTime" column="update_time" />
21 </resultMap>
22
23 <sql id="selectDictDataVo">
24 select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
25 from sys_dict_data
26 </sql>
27
28 <select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
29 <include refid="selectDictDataVo"/>
30 <where>
31 <if test="dictType != null and dictType != ''">
32 AND dict_type = #{dictType}
33 </if>
34 <if test="dictLabel != null and dictLabel != ''">
35 AND dict_label like concat('%', #{dictLabel}, '%')
36 </if>
37 <if test="status != null and status != ''">
38 AND status = #{status}
39 </if>
40 </where>
41 order by dict_sort asc
42 </select>
43
44 <select id="selectDictDataByType" parameterType="String" resultMap="SysDictDataResult">
45 <include refid="selectDictDataVo"/>
46 where status = '0' and dict_type = #{dictType} order by dict_sort asc
47 </select>
48
49 <select id="selectDictLabel" resultType="String">
50 select dict_label from sys_dict_data
51 where dict_type = #{dictType} and dict_value = #{dictValue}
52 </select>
53
54 <select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
55 <include refid="selectDictDataVo"/>
56 where dict_code = #{dictCode}
57 </select>
58
59 <select id="countDictDataByType" resultType="Integer">
60 select count(1) from sys_dict_data where dict_type=#{dictType}
61 </select>
62
63 <delete id="deleteDictDataById" parameterType="Long">
64 delete from sys_dict_data where dict_code = #{dictCode}
65 </delete>
66
67 <delete id="deleteDictDataByIds" parameterType="Long">
68 delete from sys_dict_data where dict_code in
69 <foreach collection="array" item="dictCode" open="(" separator="," close=")">
70 #{dictCode}
71 </foreach>
72 </delete>
73
74 <update id="updateDictData" parameterType="SysDictData">
75 update sys_dict_data
76 <set>
77 <if test="dictSort != null">dict_sort = #{dictSort},</if>
78 <if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
79 <if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
80 <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
81 <if test="cssClass != null">css_class = #{cssClass},</if>
82 <if test="listClass != null">list_class = #{listClass},</if>
83 <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
84 <if test="status != null">status = #{status},</if>
85 <if test="remark != null">remark = #{remark},</if>
86 <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
87 update_time = sysdate()
88 </set>
89 where dict_code = #{dictCode}
90 </update>
91
92 <update id="updateDictDataType" parameterType="String">
93 update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
94 </update>
95
96 <insert id="insertDictData" parameterType="SysDictData">
97 insert into sys_dict_data(
98 <if test="dictSort != null">dict_sort,</if>
99 <if test="dictLabel != null and dictLabel != ''">dict_label,</if>
100 <if test="dictValue != null and dictValue != ''">dict_value,</if>
101 <if test="dictType != null and dictType != ''">dict_type,</if>
102 <if test="cssClass != null and cssClass != ''">css_class,</if>
103 <if test="listClass != null and listClass != ''">list_class,</if>
104 <if test="isDefault != null and isDefault != ''">is_default,</if>
105 <if test="status != null">status,</if>
106 <if test="remark != null and remark != ''">remark,</if>
107 <if test="createBy != null and createBy != ''">create_by,</if>
108 create_time
109 )values(
110 <if test="dictSort != null">#{dictSort},</if>
111 <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
112 <if test="dictValue != null and dictValue != ''">#{dictValue},</if>
113 <if test="dictType != null and dictType != ''">#{dictType},</if>
114 <if test="cssClass != null and cssClass != ''">#{cssClass},</if>
115 <if test="listClass != null and listClass != ''">#{listClass},</if>
116 <if test="isDefault != null and isDefault != ''">#{isDefault},</if>
117 <if test="status != null">#{status},</if>
118 <if test="remark != null and remark != ''">#{remark},</if>
119 <if test="createBy != null and createBy != ''">#{createBy},</if>
120 sysdate()
121 )
122 </insert>
123
124</mapper>