SmartScenseDataMapper.xml
8.89 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?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.glsx.smart.mapper.SmartScenseDataMapper">
<resultMap id="BaseResultMap" type="com.glsx.smart.entity.SmartScenseData">
<!--@mbg.generated-->
<!--@Table smart_scense_data-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="template_id" jdbcType="BIGINT" property="templateId"/>
<result column="type" jdbcType="TINYINT" property="type"/>
<result column="sort" jdbcType="TINYINT" property="sort"/>
<result column="param_key" jdbcType="VARCHAR" property="paramKey"/>
<result column="param_value" jdbcType="VARCHAR" property="paramValue"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, template_id, `type`, sort, param_key, param_value
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update smart_scense_data
<trim prefix="set" suffixOverrides=",">
<trim prefix="template_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.templateId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="`type` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.type,jdbcType=TINYINT}
</foreach>
</trim>
<trim prefix="sort = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.sort,jdbcType=TINYINT}
</foreach>
</trim>
<trim prefix="param_key = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paramKey,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="param_value = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.paramValue,jdbcType=VARCHAR}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update smart_scense_data
<trim prefix="set" suffixOverrides=",">
<trim prefix="template_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.templateId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.templateId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="`type` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.type != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.type,jdbcType=TINYINT}
</if>
</foreach>
</trim>
<trim prefix="sort = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.sort != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.sort,jdbcType=TINYINT}
</if>
</foreach>
</trim>
<trim prefix="param_key = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paramKey != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.paramKey,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="param_value = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.paramValue != null">
when id = #{item.id,jdbcType=BIGINT} then
#{item.paramValue,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
useGeneratedKeys="true">
<!--@mbg.generated-->
insert into smart_scense_data
(template_id, `type`, sort, param_key, param_value)
values
<foreach collection="list" item="item" separator=",">
(#{item.templateId,jdbcType=BIGINT}, #{item.type,jdbcType=TINYINT},
#{item.sort,jdbcType=TINYINT},
#{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.entity.SmartScenseData" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into smart_scense_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
template_id,
`type`,
sort,
param_key,
param_value,
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
#{templateId,jdbcType=BIGINT},
#{type,jdbcType=TINYINT},
#{sort,jdbcType=TINYINT},
#{paramKey,jdbcType=VARCHAR},
#{paramValue,jdbcType=VARCHAR},
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=BIGINT},
</if>
template_id = #{templateId,jdbcType=BIGINT},
`type` = #{type,jdbcType=TINYINT},
sort = #{sort,jdbcType=TINYINT},
param_key = #{paramKey,jdbcType=VARCHAR},
param_value = #{paramValue,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.entity.SmartScenseData" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into smart_scense_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="templateId != null">
template_id,
</if>
<if test="type != null">
`type`,
</if>
<if test="sort != null">
sort,
</if>
<if test="paramKey != null and paramKey != ''">
param_key,
</if>
<if test="paramValue != null and paramValue != ''">
param_value,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="templateId != null">
#{templateId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
<if test="sort != null">
#{sort,jdbcType=TINYINT},
</if>
<if test="paramKey != null and paramKey != ''">
#{paramKey,jdbcType=VARCHAR},
</if>
<if test="paramValue != null and paramValue != ''">
#{paramValue,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=BIGINT},
</if>
<if test="templateId != null">
template_id = #{templateId,jdbcType=BIGINT},
</if>
<if test="type != null">
`type` = #{type,jdbcType=TINYINT},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=TINYINT},
</if>
<if test="paramKey != null and paramKey != ''">
param_key = #{paramKey,jdbcType=VARCHAR},
</if>
<if test="paramValue != null and paramValue != ''">
param_value = #{paramValue,jdbcType=VARCHAR},
</if>
</trim>
</insert>
</mapper>