HisToryRecordMapper.xml
9.75 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
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
144
145
146
147
148
149
150
151
<?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.genersoft.iot.vmp.vmanager.jt1078.platform.mapper.HisToryRecordMapper">
<resultMap id="HISTORY_RECORD_LIST_MAP" type="com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="sim" column="sim" />
<result property="channel" column="channel" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="status" column="status" />
<result property="ip" column="ip" />
<result property="port" column="port" />
<result property="username" column="username" />
<result property="password" column="password" />
<result property="path" column="path" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="HISTORY_RECORD_LIST_SQL">
SELECT
id,
name,
sim,
channel,
start_time,
end_time,
status,
ip,
port,
username,
password,
path,
create_time,
update_time,
create_by,
update_by,
remark
FROM `wvp_history_record`
</sql>
<insert id="addOrUpdRecode">
INSERT INTO `wvp_history_record`
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test=" id != null and id != '' ">`id` ,</if>
<if test=" name != null and name != '' ">`name` ,</if>
<if test=" sim != null and sim != '' ">`sim` ,</if>
<if test=" channel != null and channel != '' ">`channel` ,</if>
<if test=" startTime != null and startTime != '' ">`start_time` ,</if>
<if test=" endTime != null and endTime != '' ">`end_time` ,</if>
<if test=" status != null and status != '' ">`status` ,</if>
<if test=" ip != null and ip != '' ">`ip` ,</if>
<if test=" port != null ">`port` ,</if>
<if test=" username != null and username != '' ">`username` ,</if>
<if test=" password != null and password != '' ">`password` ,</if>
<if test=" path != null and path != '' ">`path` ,</if>
<if test=" createTime != null ">`create_time` ,</if>
<if test=" updateTime != null ">`update_time` ,</if>
<if test=" createBy != null and createBy != '' ">`create_by` ,</if>
<if test=" updateBy != null and updateBy != '' ">`update_by` ,</if>
<if test=" remark != null and remark != '' ">`remark` ,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test=" id != null and id != '' "> #{id}, </if>
<if test=" name != null and name != '' "> #{name}, </if>
<if test=" sim != null and sim != '' "> #{sim}, </if>
<if test=" channel != null and channel != '' "> #{channel}, </if>
<if test=" startTime != null and startTime != '' "> #{startTime}, </if>
<if test=" endTime != null and endTime != '' "> #{endTime}, </if>
<if test=" status != null and status != '' "> #{status}, </if>
<if test=" ip != null and ip != '' "> #{ip}, </if>
<if test=" port != null "> #{port}, </if>
<if test=" username != null and username != '' "> #{username}, </if>
<if test=" password != null and password != '' "> #{password}, </if>
<if test=" path != null and path != '' "> #{path}, </if>
<if test=" createTime != null "> #{createTime} , </if>
<if test=" updateTime != null "> #{updateTime}, </if>
<if test=" createBy != null and createBy != '' "> #{createBy}, </if>
<if test=" updateBy != null and updateBy != '' "> #{updateBy}, </if>
<if test=" remark != null and remark != '' "> #{remark}, </if>
</trim>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
<if test=" id != null and id != '' "> `id` = #{id}, </if>
<if test=" name != null and name != '' "> `name` = #{name}, </if>
<if test=" sim != null and sim != '' "> `sim` = #{sim}, </if>
<if test=" channel != null and channel != '' "> `channel` = #{channel}, </if>
<if test=" startTime != null and startTime != '' "> `start_time` = #{startTime}, </if>
<if test=" endTime != null and endTime != '' "> `end_time` = #{endTime}, </if>
<if test=" status != null and status != '' "> `status` = #{status}, </if>
<if test=" ip != null and ip != '' "> `ip` = #{ip}, </if>
<if test=" port != null "> `port` = #{port}, </if>
<if test=" username != null and username != '' "> `username` = #{username}, </if>
<if test=" password != null and password != '' "> `password` = #{password}, </if>
<if test=" path != null and path != '' "> `path` = #{path}, </if>
<if test=" createTime != null "> `create_time` = #{createTime} , </if>
<if test=" updateTime != null "> `update_time` = #{updateTime}, </if>
<if test=" createBy != null and createBy != '' "> `create_by` = #{createBy}, </if>
<if test=" updateBy != null and updateBy != '' "> `update_by` = #{updateBy}, </if>
<if test=" remark != null and remark != '' "> `remark` = #{remark}, </if>
</trim>
</insert>
<update id="beachUpdRecode">
<foreach collection="list" item="item" separator=";">
UPDATE `wvp_history_record`
<set>
<if test="item.sim != null and item.sim != '' ">`sim` = #{item.sim}, </if>
<if test="item.channel != null and item.channel != '' ">`channel` = #{item.channel}, </if>
<if test="item.startTime != null and item.startTime != '' ">`start_time` = #{item.startTime}, </if>
<if test="item.endTime != null and item.endTime != '' ">`end_time` = #{item.endTime}, </if>
<if test="item.status != null and item.status != '' ">`status` = #{item.status}, </if>
<if test="item.ip != null and item.ip != '' ">`ip` = #{item.ip}, </if>
<if test="item.port != null ">`port` = #{item.port}, </if>
<if test="item.username != null and item.username != '' ">`username` = #{item.username}, </if>
<if test="item.password != null and item.password != '' ">`password` = #{item.password}, </if>
<if test="item.path != null and item.path != '' ">`path` = #{item.path}, </if>
<if test="item.path == null ">`path` = NULL, </if>
<if test="item.createTime != null ">`create_time` = #{item.createTime} , </if>
<if test="item.updateTime != null ">`update_time` = #{item.updateTime}, </if>
<if test="item.createBy != null and item.createBy != '' ">`create_by` = #{item.createBy}, </if>
<if test="item.updateBy != null and item.updateBy != '' ">`update_by` = #{item.updateBy}, </if>
<if test="item.remark != null and item.remark != '' ">`remark` = #{item.remark}, </if>
</set>
WHERE
`name` = #{item.name}
</foreach>
</update>
<update id="updateStatusByName">
update `wvp_history_record` set `status` = #{status} where name = #{name}
</update>
<select id="getHistoryRecordList"
resultMap="HISTORY_RECORD_LIST_MAP">
<include refid="HISTORY_RECORD_LIST_SQL" />
</select>
<select id="getHistoryRecord"
resultMap="HISTORY_RECORD_LIST_MAP">
<include refid="HISTORY_RECORD_LIST_SQL" />
WHERE `name` = #{stream}
</select>
</mapper>