‘liusuyi’
2023-08-24 bc6ac2f55b2ddec81614ebf7722760b4868f76db
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
<?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.device.channel.mapper.ArdChannelMapper">
    
    <resultMap type="ArdChannel" id="ArdChannelResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="chanNo"    column="chan_no"    />
        <result property="deviceId"    column="device_id"    />
    </resultMap>
 
    <sql id="selectArdChannelVo">
        select id, name, chan_no, device_id from ard_channel
    </sql>
 
    <select id="selectArdChannelList" parameterType="ArdChannel" resultMap="ArdChannelResult">
        <include refid="selectArdChannelVo"/>
        <where>
            <if test="deviceId!=null">device_id=#{deviceId}</if>
        </where>
    </select>
    
    <select id="selectArdChannelById" parameterType="String" resultMap="ArdChannelResult">
        <include refid="selectArdChannelVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdChannel" parameterType="ArdChannel">
        insert into ard_channel
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="name != null">name,</if>
            <if test="chanNo != null">chan_no,</if>
            <if test="deviceId != null">device_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="name != null">#{name},</if>
            <if test="chanNo != null">#{chanNo},</if>
            <if test="deviceId != null">#{deviceId},</if>
         </trim>
    </insert>
 
    <update id="updateArdChannel" parameterType="ArdChannel">
        update ard_channel
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="chanNo != null">chan_no = #{chanNo},</if>
            <if test="deviceId != null">device_id = #{deviceId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdChannelById" parameterType="String">
        delete from ard_channel where id = #{id}
    </delete>
 
    <delete id="deleteArdChannelByIds" parameterType="String">
        delete from ard_channel where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="deleteArdChannelByDeviceId" parameterType="String">
        delete from ard_channel where device_id = #{deviceId}
    </delete>
</mapper>