wlzboy
1 天以前 08f95b2f159b56fa3bd4f4b348855989de8aa456
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
<?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.NotifyChannelConfigMapper">
    
    <resultMap type="NotifyChannelConfig" id="NotifyChannelConfigResult">
        <id     property="id"           column="id"/>
        <result property="notifyType"   column="notify_type"/>
        <result property="channel"      column="channel"/>
        <result property="enabled"      column="enabled"/>
        <result property="priority"     column="priority"/>
        <result property="configJson"   column="config_json"/>
        <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="selectNotifyChannelConfigVo">
        select id, notify_type, channel, enabled, priority, config_json,
               create_by, create_time, update_by, update_time, remark
        from sys_notify_channel_config
    </sql>
 
    <select id="selectNotifyChannelConfigById" parameterType="Long" resultMap="NotifyChannelConfigResult">
        <include refid="selectNotifyChannelConfigVo"/>
        where id = #{id}
    </select>
 
    <select id="selectNotifyChannelConfigList" parameterType="NotifyChannelConfig" resultMap="NotifyChannelConfigResult">
        <include refid="selectNotifyChannelConfigVo"/>
        <where>
            <if test="notifyType != null and notifyType != ''">
                AND notify_type = #{notifyType}
            </if>
            <if test="channel != null and channel != ''">
                AND channel = #{channel}
            </if>
            <if test="enabled != null and enabled != ''">
                AND enabled = #{enabled}
            </if>
        </where>
        order by priority desc
    </select>
 
    <select id="selectEnabledChannelsByType" parameterType="String" resultMap="NotifyChannelConfigResult">
        <include refid="selectNotifyChannelConfigVo"/>
        where notify_type = #{notifyType} and enabled = '1'
        order by priority desc
    </select>
 
    <select id="selectByTypeAndChannel" resultMap="NotifyChannelConfigResult">
        <include refid="selectNotifyChannelConfigVo"/>
        where notify_type = #{notifyType} and channel = #{channel}
    </select>
 
    <insert id="insertNotifyChannelConfig" parameterType="NotifyChannelConfig" useGeneratedKeys="true" keyProperty="id">
        insert into sys_notify_channel_config (
            notify_type, channel, enabled, priority, config_json,
            create_by, create_time, update_by, update_time, remark
        ) values (
            #{notifyType}, #{channel}, #{enabled}, #{priority}, #{configJson},
            #{createBy}, sysdate(), #{updateBy}, sysdate(), #{remark}
        )
    </insert>
 
    <update id="updateNotifyChannelConfig" parameterType="NotifyChannelConfig">
        update sys_notify_channel_config
        <set>
            <if test="notifyType != null">notify_type = #{notifyType},</if>
            <if test="channel != null">channel = #{channel},</if>
            <if test="enabled != null">enabled = #{enabled},</if>
            <if test="priority != null">priority = #{priority},</if>
            <if test="configJson != null">config_json = #{configJson},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where id = #{id}
    </update>
 
    <delete id="deleteNotifyChannelConfigById" parameterType="Long">
        delete from sys_notify_channel_config where id = #{id}
    </delete>
    
    <delete id="deleteNotifyChannelConfigByIds" parameterType="Long">
        delete from sys_notify_channel_config where id in 
        <foreach collection="array" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>