leutu
2024-06-03 3ef35e6cd16bbfa206b26bb3271eac40ad020bcb
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.fastbee.iot.mapper.ProtocolMapper">
    <resultMap id="BaseResultMap" type="com.fastbee.iot.domain.Protocol">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="protocol_code" jdbcType="VARCHAR" property="protocolCode"/>
        <result column="protocol_name" jdbcType="VARCHAR" property="protocolName"/>
        <result column="protocol_file_url" jdbcType="VARCHAR" property="protocolFileUrl"/>
        <result column="protocol_type" jdbcType="INTEGER" property="protocolType"/>
        <result column="jar_sign" jdbcType="VARCHAR" property="jarSign"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="protocol_status" jdbcType="INTEGER" property="protocolStatus"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, protocol_code, protocol_name, protocol_file_url, protocol_type,
    jar_sign, create_time, update_time, protocol_status, del_flag
    </sql>
 
    <sql id="selectProtocolVo">
        select id, protocol_code, protocol_name, protocol_file_url, protocol_type,
               jar_sign, create_time, update_time, protocol_status, del_flag from iot_protocol
    </sql>
 
 
    <select id="selectByUnion" parameterType="com.fastbee.iot.domain.Protocol" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from iot_protocol
        where
        1 = 1
        <if test="protocolStatus != null">
            AND protocol_status = #{protocolStatus}
        </if>
        <if test="delFlag != null">
            AND del_flag = #{delFlag,jdbcType=INTEGER}
        </if>
    </select>
 
    <select id="selectAll" parameterType="com.fastbee.iot.domain.Protocol" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from iot_protocol
        where
        1 = 1
        <if test="protocolCode != null">
            AND protocol_code = #{protocolCode,jdbcType=VARCHAR}
        </if>
        <if test="protocolName != null">
            AND protocol_name = #{protocolName,jdbcType=VARCHAR}
        </if>
 
        <if test="protocolFileUrl != null">
            AND protocol_file_url = #{protocolFileUrl,jdbcType=VARCHAR}
        </if>
        <if test="protocolType != null">
            AND protocol_type = #{protocolType,jdbcType=INTEGER},
        </if>
        <if test="jarSign != null">
            AND jar_sign = #{jarSign,jdbcType=VARCHAR},
        </if>
        <if test="createTime != null">
            AND create_time = #{createTime,jdbcType=TIMESTAMP}
        </if>
        <if test="updateTime != null">
            AND update_time = #{updateTime,jdbcType=TIMESTAMP}
        </if>
        <if test="protocolStatus != null">
            AND protocol_status = #{protocolStatus,jdbcType=INTEGER}
        </if>
    </select>
 
    <select id="selectProtocolList" parameterType="Protocol" resultMap="BaseResultMap">
        <include refid="selectProtocolVo"/>
        <where>
            <if test="protocolCode != null  and protocolCode != ''"> and protocol_code = #{protocolCode}</if>
            <if test="protocolName != null  and protocolName != ''"> and protocol_name like concat('%', #{protocolName}, '%')</if>
            <if test="protocolFileUrl != null  and protocolFileUrl != ''"> and protocol_file_url = #{protocolFileUrl}</if>
            <if test="protocolType != null "> and protocol_type = #{protocolType}</if>
            <if test="jarSign != null  and jarSign != ''"> and jar_sign = #{jarSign}</if>
            <if test="protocolStatus != null "> and protocol_status = #{protocolStatus}</if>
        </where>
    </select>
 
    <select id="selectProtocolById" parameterType="Long" resultMap="BaseResultMap">
        <include refid="selectProtocolVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertProtocol" parameterType="Protocol" useGeneratedKeys="true" keyProperty="id">
        insert into iot_protocol
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="protocolCode != null and protocolCode != ''">protocol_code,</if>
            <if test="protocolName != null and protocolName != ''">protocol_name,</if>
            <if test="protocolFileUrl != null and protocolFileUrl != ''">protocol_file_url,</if>
            <if test="protocolType != null">protocol_type,</if>
            <if test="jarSign != null and jarSign != ''">jar_sign,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="protocolStatus != null">protocol_status,</if>
            <if test="delFlag != null">del_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="protocolCode != null and protocolCode != ''">#{protocolCode},</if>
            <if test="protocolName != null and protocolName != ''">#{protocolName},</if>
            <if test="protocolFileUrl != null and protocolFileUrl != ''">#{protocolFileUrl},</if>
            <if test="protocolType != null">#{protocolType},</if>
            <if test="jarSign != null and jarSign != ''">#{jarSign},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="protocolStatus != null">#{protocolStatus},</if>
            <if test="delFlag != null">#{delFlag},</if>
        </trim>
    </insert>
 
    <update id="updateProtocol" parameterType="Protocol">
        update iot_protocol
        <trim prefix="SET" suffixOverrides=",">
            <if test="protocolCode != null and protocolCode != ''">protocol_code = #{protocolCode},</if>
            <if test="protocolName != null and protocolName != ''">protocol_name = #{protocolName},</if>
            <if test="protocolFileUrl != null and protocolFileUrl != ''">protocol_file_url = #{protocolFileUrl},</if>
            <if test="protocolType != null">protocol_type = #{protocolType},</if>
            <if test="jarSign != null and jarSign != ''">jar_sign = #{jarSign},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="protocolStatus != null">protocol_status = #{protocolStatus},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteProtocolById" parameterType="Long">
        delete from iot_protocol where id = #{id}
    </delete>
 
    <delete id="deleteProtocolByIds" parameterType="String">
        delete from iot_protocol where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>