zouyu
2025-03-01 e7a77fffb72595958d245598c4abe87c6b4b84b6
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
<?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.ruoyi.system.mapper.SysDictTypeMapper">
    <resultMap type="SysDictType" id="SysDictTypeResult">
        <id property="dictId" column="dict_id"/>
        <result property="dictName" column="dict_name"/>
        <result property="dictType" column="dict_type"/>
        <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"/>
    </resultMap>
 
    <sql id="selectDictTypeVo">
        select dict_id, dict_name, dict_type, status, create_by, create_time, remark
        from sys_dict_type
    </sql>
 
    <select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        <where>
            <if test="dictName != null and dictName != ''">
                AND dict_name like concat('%', #{dictName}, '%')
            </if>
            <if test="status != null and status != ''">
                AND status = #{status}
            </if>
            <if test="dictType != null and dictType != ''">
                AND dict_type like concat('%', #{dictType}, '%')
            </if>
            <if test="params.beginTime != null and params.beginTime != ''">
                <!-- 开始时间检索 -->
                and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''">
                <!-- 结束时间检索 -->
                and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
            </if>
        </where>
    </select>
 
    <select id="selectDictTypeAll" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
    </select>
 
    <select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_id = #{dictId}
    </select>
 
    <select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_type = #{dictType}
    </select>
 
    <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_type = #{dictType} limit 1
    </select>
 
    <delete id="deleteDictTypeById" parameterType="Long">
        delete
        from sys_dict_type
        where dict_id = #{dictId}
    </delete>
 
    <delete id="deleteDictTypeByIds" parameterType="Long">
        delete from sys_dict_type where dict_id in
        <foreach collection="array" item="dictId" open="(" separator="," close=")">
            #{dictId}
        </foreach>
    </delete>
 
    <update id="updateDictType" parameterType="SysDictType">
        update sys_dict_type
        <set>
            <if test="dictName != null and dictName != ''">
                dict_name = #{dictName},
            </if>
            <if test="dictType != null and dictType != ''">
                dict_type = #{dictType},
            </if>
            <if test="status != null">
                status = #{status},
            </if>
            <if test="remark != null">
                remark = #{remark},
            </if>
            <if test="updateBy != null and updateBy != ''">
                update_by = #{updateBy},
            </if>
            update_time = sysdate()
        </set>
        where dict_id = #{dictId}
    </update>
 
    <insert id="insertDictType" parameterType="SysDictType">
        insert into sys_dict_type(
        <if test="dictName != null and dictName != ''">
            dict_name,
        </if>
        <if test="dictType != null and dictType != ''">
            dict_type,
        </if>
        <if test="status != null">
            status,
        </if>
        <if test="remark != null and remark != ''">
            remark,
        </if>
        <if test="createBy != null and createBy != ''">
            create_by,
        </if>
        create_time
        )values(
        <if test="dictName != null and dictName != ''">
            #{dictName},
        </if>
        <if test="dictType != null and dictType != ''">
            #{dictType},
        </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>
 
    <select id="selectList" resultType="com.ruoyi.common.core.domain.entity.SysDictType">
        select *
        from sys_dict_type
        where dict_name = #{dictName}
    </select>
</mapper>