IotLsyPlcConfigMapper.xml
4.4 KB
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
<?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.zhonglai.luhui.device.mapper.IotLsyPlcConfigMapper">
<resultMap type="IotLsyPlcConfig" id="IotLsyPlcConfigResult">
<result property="id" column="id" />
<result property="alterName" column="alter_name" />
<result property="alterAddr" column="alter_addr" />
<result property="upName" column="up_name" />
<result property="upInterval" column="up_interval" />
<result property="createTime" column="create_time" />
<result property="prejectType" column="preject_type" />
<result property="deviceType" column="device_type" />
</resultMap>
<sql id="selectIotLsyPlcConfigVo">
select id, alter_name, alter_addr, up_name, up_interval, create_time, preject_type, device_type from iot_lsy_plc_config
</sql>
<select id="selectIotLsyPlcConfigList" parameterType="IotLsyPlcConfig" resultMap="IotLsyPlcConfigResult">
<include refid="selectIotLsyPlcConfigVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="alterName != null and alterName != ''"> and alter_name like concat('%', #{alterName}, '%')</if>
<if test="alterAddr != null and alterAddr != ''"> and alter_addr = #{alterAddr}</if>
<if test="upName != null and upName != ''"> and up_name like concat('%', #{upName}, '%')</if>
<if test="upInterval != null "> and up_interval = #{upInterval}</if>
<if test="prejectType != null "> and preject_type = #{prejectType}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
</where>
</select>
<select id="selectIotLsyPlcConfigById" parameterType="Integer" resultMap="IotLsyPlcConfigResult">
<include refid="selectIotLsyPlcConfigVo"/>
where id = #{id}
</select>
<insert id="insertIotLsyPlcConfig" parameterType="IotLsyPlcConfig" useGeneratedKeys="true" keyProperty="id">
insert into iot_lsy_plc_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="alterName != null and alterName != ''">alter_name,</if>
<if test="alterAddr != null and alterAddr != ''">alter_addr,</if>
<if test="upName != null and upName != ''">up_name,</if>
<if test="upInterval != null">up_interval,</if>
<if test="createTime != null">create_time,</if>
<if test="prejectType != null">preject_type,</if>
<if test="deviceType != null">device_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="alterName != null and alterName != ''">#{alterName},</if>
<if test="alterAddr != null and alterAddr != ''">#{alterAddr},</if>
<if test="upName != null and upName != ''">#{upName},</if>
<if test="upInterval != null">#{upInterval},</if>
<if test="createTime != null">#{createTime},</if>
<if test="prejectType != null">#{prejectType},</if>
<if test="deviceType != null">#{deviceType},</if>
</trim>
</insert>
<update id="updateIotLsyPlcConfig" parameterType="IotLsyPlcConfig">
update iot_lsy_plc_config
<trim prefix="SET" suffixOverrides=",">
<if test="alterName != null and alterName != ''">alter_name = #{alterName},</if>
<if test="alterAddr != null and alterAddr != ''">alter_addr = #{alterAddr},</if>
<if test="upName != null and upName != ''">up_name = #{upName},</if>
<if test="upInterval != null">up_interval = #{upInterval},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="prejectType != null">preject_type = #{prejectType},</if>
<if test="deviceType != null">device_type = #{deviceType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIotLsyPlcConfigById" parameterType="Integer">
delete from iot_lsy_plc_config where id = #{id}
</delete>
<delete id="deleteIotLsyPlcConfigByIds" parameterType="Integer">
delete from iot_lsy_plc_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>