ParkingLotEquipmentSMapper.xml
13.2 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<?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.zteits.park.mapper.smapper.ParkingLotEquipmentSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.ParkingLotEquipment">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="node_type" jdbcType="VARCHAR" property="nodeType" />
<result column="area_id" jdbcType="BIGINT" property="areaId" />
<result column="channel_id" jdbcType="BIGINT" property="channelId" />
<result column="parent_equipment_id" jdbcType="BIGINT" property="parentEquipmentId" />
<result column="equipment_name" jdbcType="VARCHAR" property="equipmentName" />
<result column="equipment_description" jdbcType="VARCHAR" property="equipmentDescription" />
<result column="equipment_type" jdbcType="INTEGER" property="equipmentType" />
<result column="equipment_use" jdbcType="INTEGER" property="equipmentUse" />
<result column="equipment_driver" jdbcType="VARCHAR" property="equipmentDriver" />
<result column="equipment_manufacturer" jdbcType="VARCHAR" property="equipmentManufacturer" />
<result column="equipment_model" jdbcType="VARCHAR" property="equipmentModel" />
<result column="equipment_serial_number" jdbcType="VARCHAR" property="equipmentSerialNumber" />
<result column="equipment_level" jdbcType="INTEGER" property="equipmentLevel" />
<result column="equipment_status" jdbcType="INTEGER" property="equipmentStatus" />
<result column="channel_name" jdbcType="VARCHAR" property="channelName" />
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
<result column="screen_line_number" jdbcType="INTEGER" property="screenLineNumber" />
<collection property="detailList"
select="com.zteits.park.mapper.ParkingLotEquipmentMapper.getEquipmentCongif"
column="id">
</collection>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, pl_no, node_type, area_id, channel_id, parent_equipment_id, equipment_name, equipment_description,
equipment_type, equipment_use, equipment_driver, equipment_manufacturer, equipment_model,
equipment_serial_number, equipment_level, equipment_status
</sql>
<select id="selectByEquipment" parameterType="com.zteits.clouds.api.dto.park.param.closecarpark.QueryEquipmentRequest"
resultType="com.zteits.clouds.api.dto.park.dto.ParkingEquipmentInfoDTO">
select
e.id,
e.equipment_name as equipmentName,
t.equipment_type_name as equipmentTypeName,
a.area_name as areaName,
c.channel_name as channelName,
e.screen_line_number screenLineNumber
from parking_lot_equipment e
left join parking_lot_areas a on e.area_id = a.id
left join parking_lot_channel c on e.channel_id = c.id
left join parking_lot_equipment_type t on e.equipment_type = t.equipment_type_code
where 1=1
<if test="plNo != null and plNo != ''">
and e.pl_no = #{plNo}
</if>
<if test="equipmentType != null and equipmentType != ''">
and e.equipment_type = #{equipmentType}
</if>
<if test="channelId != null and channelId != ''">
and e.channel_id = #{channelId}
</if>
</select>
<select id="selectTreeByExample" parameterType="com.zteits.clouds.api.dto.park.param.closecarpark.QueryEquipmentTreeListRequest"
resultType="com.zteits.clouds.api.dto.park.dto.ParkingTreeListDTO">
SELECT
a.id,
a.id as treeId,
a.parent_id as parentId,
a.parent_id as treeParentId,
a.area_name as label,
a.area_type as type,
a.pl_no as plNo,
t.pl_name as plName,
null as isTideChannel
FROM
parking_lot_areas a
LEFT JOIN parking_lot t on
a.pl_no = t.pl_no
where a.data_status = 1
<if test="parkCode != null and parkCode != ''">
and a.pl_no = #{parkCode}
</if>
UNION ALL
SELECT
concat(c.id,'a') as id,
c.id as treeId,
c.area_id as parentId,
c.area_id as treeParentId,
c.channel_name as label,
'3' AS type,
c.pl_no as plNo,
t.pl_name as plName,
c.is_tide_channel as isTideChannel
FROM
parking_lot_channel c
LEFT JOIN parking_lot t on
c.pl_no = t.pl_no
where c.data_status = 1
<if test="parkCode != null and parkCode != ''">
and c.pl_no = #{parkCode}
</if>
UNION ALL
SELECT
concat(e.id,'b') as id,
e.id as treeId,
if(e.channel_id = 0,e.area_id,if(e.parent_equipment_id = 0,concat(e.channel_id,'a'),concat(e.parent_equipment_id,'b'))) as parentId,
if(e.channel_id = 0,e.area_id,if(e.parent_equipment_id = 0,e.channel_id,e.parent_equipment_id)) as treeParentId,
e.equipment_name as label,
'4' as type,
e.pl_no as plNo,
t.pl_name as plName,
null as isTideChannel
FROM
parking_lot_equipment e
LEFT JOIN parking_lot t on
e.pl_no = t.pl_no
<if test="parkCode != null and parkCode != ''">
where e.pl_no = #{parkCode}
</if>
</select>
<select id="QueryEquipmentDetail" parameterType="com.zteits.clouds.api.dto.park.param.closecarpark.QueryEquipmentDetailRequest"
resultMap="BaseResultMap">
select
e.id,
e.pl_no,
e.node_type,
e.area_id,
e.channel_id,
e.parent_equipment_id,
e.equipment_name,
e.equipment_description,
e.equipment_type,
e.equipment_use,
e.equipment_driver,
e.equipment_manufacturer,
e.equipment_model,
e.equipment_serial_number,
e.equipment_level,
e.equipment_status,
e.screen_line_number,
a.area_name,
c.channel_name
from parking_lot_equipment e
left join parking_lot_areas a on e.area_id = a.id
left join parking_lot_channel c on e.channel_id = c.id
where e.id = #{id,jdbcType=BIGINT}
</select>
<select id="getEquipmentCongif" parameterType="com.zteits.clouds.api.dto.park.param.closecarpark.QueryEquipmentDetailRequest"
resultType="com.zteits.clouds.api.dto.park.dto.ParkingEquipmentConfigInfoDTO">
select
config_key as configKey,
config_value as configValue,
config_description as configDescription
from parking_lot_equipment_config_detail
where equipment_id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByEquipmentId" parameterType="java.lang.Long">
delete from parking_lot_equipment_config_detail
where equipment_id = #{equipmentId,jdbcType=BIGINT}
</delete>
<insert id="insertDetailInfo" parameterType="java.util.List">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into parking_lot_equipment_config_detail ( equipment_id,config_key, config_value,
config_description)
values
<foreach collection="list" item="item" separator=",">
( #{item.equipmentId,jdbcType=BIGINT},#{item.configKey,jdbcType=VARCHAR},
#{item.configValue,jdbcType=VARCHAR}, #{item.configDescription,jdbcType=VARCHAR})
</foreach>
</insert>
<!--<insert id="insertSelectiveDto" parameterType="com.zteits.park.domain.ParkingLotEquipment" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into parking_lot_equipment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="plNo != null">
pl_no,
</if>
<if test="nodeType != null">
node_type,
</if>
<if test="areaId != null">
area_id,
</if>
<if test="channelId != null">
channel_id,
</if>
<if test="parentEquipmentId != null">
parent_equipment_id,
</if>
<if test="equipmentName != null">
equipment_name,
</if>
<if test="equipmentDescription != null">
equipment_description,
</if>
<if test="equipmentType != null">
equipment_type,
</if>
<if test="equipmentUse != null">
equipment_use,
</if>
<if test="equipmentDriver != null">
equipment_driver,
</if>
<if test="equipmentManufacturer != null">
equipment_manufacturer,
</if>
<if test="equipmentModel != null">
equipment_model,
</if>
<if test="equipmentSerialNumber != null">
equipment_serial_number,
</if>
<if test="equipmentLevel != null">
equipment_level,
</if>
<if test="equipmentStatus != null">
equipment_status,
</if>
<if test="screenLineNumber != null">
screen_line_number,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="plNo != null">
#{plNo,jdbcType=VARCHAR},
</if>
<if test="nodeType != null">
#{nodeType,jdbcType=VARCHAR},
</if>
<if test="areaId != null">
#{areaId,jdbcType=BIGINT},
</if>
<if test="channelId != null">
#{channelId,jdbcType=BIGINT},
</if>
<if test="parentEquipmentId != null">
#{parentEquipmentId,jdbcType=BIGINT},
</if>
<if test="equipmentName != null">
#{equipmentName,jdbcType=VARCHAR},
</if>
<if test="equipmentDescription != null">
#{equipmentDescription,jdbcType=VARCHAR},
</if>
<if test="equipmentType != null">
#{equipmentType,jdbcType=INTEGER},
</if>
<if test="equipmentUse != null">
#{equipmentUse,jdbcType=INTEGER},
</if>
<if test="equipmentDriver != null">
#{equipmentDriver,jdbcType=VARCHAR},
</if>
<if test="equipmentManufacturer != null">
#{equipmentManufacturer,jdbcType=VARCHAR},
</if>
<if test="equipmentModel != null">
#{equipmentModel,jdbcType=VARCHAR},
</if>
<if test="equipmentSerialNumber != null">
#{equipmentSerialNumber,jdbcType=VARCHAR},
</if>
<if test="equipmentLevel != null">
#{equipmentLevel,jdbcType=INTEGER},
</if>
<if test="equipmentStatus != null">
#{equipmentStatus,jdbcType=INTEGER},
</if>
<if test="screenLineNumber != null">
#{screenLineNumber,jdbcType=INTEGER},
</if>
</trim>
</insert>-->
</mapper>