TpPBerthsSMapper.xml
21.7 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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
<?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.TpPBerthsSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.TpPBerths">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="park_area_code" jdbcType="VARCHAR" property="parkAreaCode" />
<result column="berth_no" jdbcType="VARCHAR" property="berthNo" />
<result column="car_no" jdbcType="VARCHAR" property="carNo" />
<result column="order_id" jdbcType="VARCHAR" property="orderId" />
<result column="is_occupy" jdbcType="CHAR" property="isOccupy" />
<result column="road_position" jdbcType="CHAR" property="roadPosition" />
<result column="direction" jdbcType="CHAR" property="direction" />
<result column="park_type" jdbcType="CHAR" property="parkType" />
<result column="berth_address" jdbcType="VARCHAR" property="berthAddress" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="car_status" jdbcType="VARCHAR" property="carStatus" />
<result column="create_op" jdbcType="BIGINT" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="BIGINT" property="modifyOp" />
<result column="opt_flg" jdbcType="CHAR" property="optFlg" />
<result column="pda_in_time" jdbcType="TIMESTAMP" property="pdaInTime" />
<result column="eqp_in_time" jdbcType="TIMESTAMP" property="eqpInTime" />
<result column="eqp_out_time" jdbcType="TIMESTAMP" property="eqpOutTime" />
<result column="pda_out_time" jdbcType="TIMESTAMP" property="pdaOutTime" />
<result column="pay_status" jdbcType="VARCHAR" property="payStatus" />
<result column="car_number_color" jdbcType="INTEGER" property="carNumberColor" />
</resultMap>
<resultMap id="BaseResultMapDO" type="com.zteits.park.domain.TpPBerthsDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="park_area_code" jdbcType="VARCHAR" property="parkAreaCode" />
<result column="berth_no" jdbcType="VARCHAR" property="berthNo" />
<result column="car_no" jdbcType="VARCHAR" property="carNo" />
<result column="road_position" jdbcType="CHAR" property="roadPosition" />
<result column="direction" jdbcType="CHAR" property="direction" />
<result column="park_type" jdbcType="CHAR" property="parkType" />
<result column="is_occupy" jdbcType="CHAR" property="isOccupy" />
<result column="car_status" jdbcType="VARCHAR" property="carStatus" />
<result column="order_id" jdbcType="VARCHAR" property="orderId" />
<result column="berth_address" jdbcType="VARCHAR" property="berthAddress" />
<result column="pda_in_time" jdbcType="TIMESTAMP" property="pdaInTime" />
<result column="eqp_in_time" jdbcType="TIMESTAMP" property="eqpInTime" />
<result column="pda_out_time" jdbcType="TIMESTAMP" property="pdaOutTime" />
<result column="eqp_out_time" jdbcType="TIMESTAMP" property="eqpOutTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="BIGINT" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="BIGINT" property="modifyOp" />
<result column="eqp_no" jdbcType="VARCHAR" property="eqpNo" />
<result column="park_area_name" jdbcType="VARCHAR" property="parkAreaName" />
</resultMap>
<sql id="Base_Column_List">
id, pl_no, park_area_code, berth_no, car_no, order_id, is_occupy, road_position,
direction, park_type, berth_address, remark, data_state, create_time, car_status,
create_op, modify_time, modify_op, opt_flg, pda_in_time, eqp_in_time, eqp_out_time,
pda_out_time, pay_status, car_number_color
</sql>
<!-- 通过车位对象查询车位信息 query berths by berth langlw 2017-8-31 -->
<!--
<select id="queryBerthByBerth" resultMap="BaseResultMapDO"
parameterType="com.zteits.clouds.api.dto.park.param.QueryBerthForPageRequest">
select
b.*,e.eqp_no,area.park_area_name
from
tp_p_berths b
LEFT JOIN tp_p_eqp e ON b.pl_no = e.pl_no AND b.berth_no = e.berth_no AND e.data_state = 1
JOIN tp_p_region_area area on area.pl_no = b.pl_no AND area.park_area_code = b.park_area_code and area.data_state = 1
where b.data_state=1
<if test="plNo != null ">
and b.pl_no =#{plNo}
</if>
<if test="parkAreaCode != null">
and b.park_area_code =#{parkAreaCode}
</if>
<if test="parkAreaCodes != null and parkAreaCodes.size>0">
and b.park_area_code IN
<foreach collection="parkAreaCodes" open="(" close=")" separator="," item="parkAreaCode">
#{parkAreaCode}
</foreach>
</if>
<if test="plNos != null and plNos.size>0">
and b.pl_no IN
<foreach collection="plNos" open="(" close=")" separator="," item="plNo">
#{plNo}
</foreach>
</if>
<if test="berthNo != null and berthNo != '' ">
and b.berth_no like concat('%',#{berthNo,jdbcType=VARCHAR},'%')
</if>
order by b.berth_no
</select> -->
<!-- 通过车位对象查询车位信息 去掉关联地磁表 -->
<select id="queryBerthByBerth" resultMap="BaseResultMapDO"
parameterType="com.zteits.clouds.api.dto.park.param.QueryBerthForPageRequest">
select
b.*,area.park_area_name
from
tp_p_berths b
JOIN tp_p_region_area area on area.pl_no = b.pl_no AND area.park_area_code = b.park_area_code and area.data_state = 1
where b.data_state in (1,2)
<if test="plNo != null ">
and b.pl_no =#{plNo}
</if>
<if test="parkAreaCode != null">
and b.park_area_code =#{parkAreaCode}
</if>
<if test="parkAreaCodes != null and parkAreaCodes.size>0">
and b.park_area_code IN
<foreach collection="parkAreaCodes" open="(" close=")" separator="," item="parkAreaCode">
#{parkAreaCode}
</foreach>
</if>
<if test="plNos != null and plNos.size>0">
and b.pl_no IN
<foreach collection="plNos" open="(" close=")" separator="," item="plNo">
#{plNo}
</foreach>
</if>
<if test="berthNo != null and berthNo != '' ">
and b.berth_no like concat('%',#{berthNo,jdbcType=VARCHAR},'%')
</if>
order by b.berth_no
</select>
<!-- 分组查询停车场车位占用率 langlw 2017-8-31 -->
<select id="queryParkOccupancyRate"
resultType="com.zteits.clouds.api.dto.park.dto.ParkOccupancyRateDTO">
SELECT
pl_no AS plNo,
park_area_code AS parkAreaCode,
sum( CASE is_occupy WHEN 1 THEN 1 ELSE 0 END ) AS useBerth,
count(1) AS allBerth
FROM
tp_p_berths
WHERE
data_state = 1
<if test="plNo != null ">
and pl_no =#{plNo}
</if>
<if test="parkAreaCode != null">
and park_area_code =#{parkAreaCode}
</if>
GROUP BY
plNo,
parkAreaCode
</select>
<update id="updateBerthByParkAreaCodesForDelete" >
update tp_p_berths
set data_state=0
where 1=1
<if test="parkAreaCodes != null and parkAreaCodes.size>0">
and park_area_code IN
<foreach collection="parkAreaCodes" open="(" close=")" separator="," item="parkAreaCode">
#{parkAreaCode}
</foreach>
</if>
</update>
<!-- 根据停车场编码获取该停车场下面的泊位数量 -->
<select id="queryBerthNumByPlNo" resultType="com.zteits.park.domain.ParkingLot">
SELECT
a.pl_no AS plNo,COUNT(a.berth_no) AS plBerthNum
FROM tp_p_berths a
WHERE a.data_state = 1
<if test="plNos != null and plNos.size>0">
and a.pl_no IN
<foreach collection="plNos" open="(" close=")" separator="," item="plNo">
#{plNo}
</foreach>
</if>
GROUP BY a.pl_no
</select>
<!-- 根据停车场编码获取空闲车位总数-->
<select id="queryFreeBerthNum" resultType="long">
SELECT
count(1)
FROM
tp_p_berths
WHERE
is_occupy = 2
AND data_state = 1
AND pl_no = #{plNo}
<if test="where != null and where != ''">
AND ${where}
</if>
</select>
<!-- 根据泊位区间编号查询泊位信息 -->
<select id="queryBerthByAreaCodes" resultType="com.zteits.park.domain.TpPBerthsDO">
SELECT
a.id AS id, a.pl_no AS plNo, a.park_area_code AS parkAreaCode,a.road_position AS roadPosition,
a.direction AS direction,a.is_occupy AS isOccupy,a.order_id AS orderId,a.car_no AS carNo,
a.berth_address AS berthAddress,berth_no AS berthNo, park_type AS parkType,park_area_name AS parkAreaName
FROM
tp_p_berths a LEFT JOIN tp_p_region_area b ON
a.park_area_code = b.park_area_code
and b.data_state=1
where 1=1
<if test="parkAreaCodes != null and parkAreaCodes.size >0">
and a.park_area_code in
<foreach collection="parkAreaCodes" open="(" close=")"
item="parkAreaCode" separator=",">
#{parkAreaCode}
</foreach>
</if>
and a.data_state=1
ORDER BY a.pl_no ASC,a.berth_no ASC
</select>
<!--校验泊位编码的唯一性-->
<select id="checkUniqueForBerthNo" parameterType="com.zteits.clouds.api.dto.park.param.CheckUniqueForBerthNoRequest" resultType="java.lang.Integer">
SELECT
count(1)
FROM
tp_p_berths a
WHERE a.data_state=1
and a.berth_no =#{berthNo}
and a.pl_no=#{plNo}
</select>
<!-- 查询不允许删除的泊位,有在停车辆或者已经关联了地磁,则不允许删除 -->
<select id="queryNotAllowDeleteBerthInfo" resultType="com.zteits.park.domain.TpPBerthsDO">
SELECT
b.pl_no as plNo,
b.berth_no as berthNo,
e.eqp_no as eqpNo,
b.order_id as orderId,
b.car_no as carNo
FROM
tp_p_berths b
inner JOIN tp_p_eqp e ON b.pl_no = e.pl_no
AND b.berth_no = e.berth_no
AND e.data_state = 1
WHERE
b.data_state = 1
AND b.id IN
<foreach collection="ids" open="(" close=")" separator="," item="id">
#{id}
</foreach>
<![CDATA[AND ( IFNULL(e.eqp_no,'')<>'' or IFNULL(b.is_occupy,2)=1) ]]>
AND b.pl_no = #{plNo}
</select>
<!--批量保存泊位信息-->
<insert id="batchSaveBerthInfo" >
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tp_p_berths (pl_no, park_area_code, berth_no,
road_position, direction,
park_type,data_state,
create_time,
create_op)
values
<foreach collection="berthList" item="berth" separator =",">
(#{berth.plNo,jdbcType=VARCHAR},
#{berth.parkAreaCode,jdbcType=VARCHAR},
#{berth.berthNo,jdbcType=VARCHAR},
#{berth.roadPosition,jdbcType=CHAR},
#{berth.direction,jdbcType=CHAR},
#{berth.parkType,jdbcType=CHAR},
#{berth.dataState,jdbcType=INTEGER},
#{berth.createTime,jdbcType=TIMESTAMP},
#{berth.createOp,jdbcType=BIGINT})
</foreach>
</insert>
<!-- 根据停车场编号查询未绑定地磁的泊位编号 -->
<select id="getBerthNoBindGeoByPlNo" resultMap="BaseResultMap">
SELECT
*
FROM
tp_p_berths
WHERE
pl_no = #{plNo} and data_state = 1
AND berth_no NOT IN (
SELECT berth_no FROM tp_p_eqp
WHERE pl_no = #{plNo} AND data_state = 1 AND <![CDATA[ifnull( eqp_no, '0' ) <> '0']]> )
order by berth_no
</select>
<!-- 根据泊位区间编号和停车场编号和泊位或者地磁编号查询车位信息 -->
<select id="queryBerthInfoByPlNoAndOther" resultType="com.zteits.clouds.api.dto.park.dto.BerthsDTO"
parameterType="com.zteits.clouds.api.dto.pda.param.QueryBerthByPlNoAndOrtherRequest">
SELECT
tb.pl_no plNo,
tb.park_area_code parkAreaCode,
tb.berth_no berthNo,
tb.car_no carNo,
tb.is_occupy isOccupy,
tb.road_position roadPosition,
tb.direction direction,
tb.park_type parkType,
tb.berth_address berthAddress,
tb.car_status carStatus,
tb.order_id orderId,
te.eqp_no eqpNo
FROM
tp_p_berths tb left join tp_p_eqp te on tb.pl_no = te.pl_no and tb.berth_no = te.berth_no and te.data_state = 1
WHERE
tb.data_state = 1
<if test="plNo != null and plNo != '' ">
and tb.pl_no = #{plNo}
</if>
<if test="parkAreaCode != null and parkAreaCode != '' ">
and tb.park_area_code = #{parkAreaCode}
</if>
<if test="berthNoOrEqpNo != null and berthNoOrEqpNo != '' ">
and (tb.berth_no like concat('%',#{berthNoOrEqpNo,jdbcType=VARCHAR},'%')
or te.eqp_no like concat('%',#{berthNoOrEqpNo,jdbcType=VARCHAR},'%') )
</if>
order by tb.pl_no,tb.berth_no
</select>
<!-- 根据停车场编号和泊位编号查询车位信息 -->
<select id="queryBerthInfoByPlNoAndBerthNo" resultType="com.zteits.clouds.api.dto.park.dto.BerthsDTO"
parameterType="com.zteits.clouds.api.dto.pda.param.QueryBerthByPlNoAndBerthNoRequest">
SELECT
tb.pl_no plNo,
tb.park_area_code parkAreaCode,
ta.park_area_name parkAreaName,
tb.berth_no berthNo,
tb.car_no carNo,
tb.is_occupy isOccupy,
tb.road_position roadPosition,
tb.direction direction,
tb.park_type parkType,
tb.berth_address berthAddress,
tb.car_status carStatus,
tb.pda_in_time pdaInTime,
tb.eqp_out_time eqpOutTime,
tb.eqp_in_time eqpInTime,
tb.pda_out_time pdaOutTime,
tb.order_id orderId,
case when te.eqp_no is null then 0 else 1 end eqpIsFixed,
te.eqp_no eqpNo
FROM
tp_p_berths tb left join tp_p_eqp te on tb.pl_no = te.pl_no and tb.berth_no = te.berth_no and te.data_state = 1,
tp_p_region_area ta
WHERE
tb.data_state = 1
and tb.park_area_code = ta.park_area_code
and tb.pl_no = ta.pl_no
and ta.data_state = 1
and tb.pl_no = #{plNo}
and tb.berth_no = #{berthNo}
</select>
<select id="queryBerthInfoByRangeNos" resultMap="BaseResultMap">
SELECT
*
FROM
tp_p_berths
WHERE
data_state =1
<if test="parkAreaCodes != null ">
and park_area_code in
<foreach collection="parkAreaCodes" open="(" close=")" separator="," item="parkAreaCode">
#{parkAreaCode}
</foreach>
</if>
<!--查询 空闲状态且没有录入数据-->
<if test="berthState != null and berthState == 1 ">
and is_occupy = 2 and (order_id is null or order_id = "")
</if>
<!--查询 未录入的车位-->
<if test="berthState != null and berthState == 2 ">
and is_occupy = 1 and (order_id is null or order_id = "")
</if>
<if test="berthState != null and berthState == -1 ">
and is_occupy in(1,2) and (order_id is null or order_id = "")
</if>
<!--查询 在停车辆 录入订单即在停,和车位状态无关-->
<if test="berthState != null and berthState == 3 ">
<![CDATA[and (order_id is not null and order_id <> "") ]]>
</if>
order by berth_no asc
</select>
<!-- 查询泊位数量统计 -->
<select id="queryBerthStatisticByOrgIds" parameterType="com.zteits.clouds.api.dto.park.param.parksource.QueryParkSourceByOrgIdsRequest"
resultType="com.zteits.clouds.api.dto.park.dto.berth.BerthsStatisticDTO">
select
sum(pl.pl_berth_num) allBerthNum,
sum(pl.pl_berth_num) - sum(ifnull(pb.free_berth,0)) isOccupyBertnNum,
sum(ifnull(pb.free_berth,0)) freeBerthNum
from parking_lot pl left join park_free_berth pb on pl.pl_no = pb.pl_no and pb.data_status = 1
where pl.data_status = 1 and state = 1
and pl.org_id in
<foreach collection="orgIds" separator="," open="(" close=")" item="orgId" index="index">
#{orgId}
</foreach>
and pl.pl_no in
<foreach collection="plNos" separator="," open="(" close=")" item="plNo" index="index">
#{plNo}
</foreach>
</select>
<!-- 各个组织对应的泊位数统计查询 -->
<select id="queryBerthStatisticForOrgId" parameterType="com.zteits.clouds.api.dto.park.param.parksource.QueryParkSourceByOrgIdsRequest"
resultType="com.zteits.clouds.api.dto.park.dto.berth.BerthsStatisticDTO">
select
pl.org_id orgId,
sum(pl.pl_berth_num) allBerthNum,
sum(pl.pl_berth_num) - sum(ifnull(pb.free_berth,0)) isOccupyBertnNum,
sum(ifnull(pb.free_berth,0)) freeBerthNum
from parking_lot pl left join park_free_berth pb on pl.pl_no = pb.pl_no and pb.data_status = 1
where pl.data_status = 1 and state = 1
and pl.org_id in
<foreach collection="orgIds" separator="," open="(" close=")" item="orgId" index="index">
#{orgId}
</foreach>
and pl.pl_no in
<foreach collection="plNos" separator="," open="(" close=")" item="plNo" index="index">
#{plNo}
</foreach>
group by pl.org_id
</select>
<select id="queryBerthNoWithEqpNoByBerthRangeNo" resultType="java.lang.String">
SELECT a.berth_no
FROM tp_p_berths a, tp_p_eqp b
WHERE a.data_state = 1 AND b.data_state = 1 AND a.berth_no = b.berth_no
AND b.pl_no = #{plNo}
AND a.park_area_code = #{berthRangeNo};
</select>
<update id="updateBerthInfoForInPark" parameterType="com.zteits.park.domain.TpPBerths">
update tp_p_berths
<set>
<if test="plNo != null">
pl_no = #{plNo,jdbcType=VARCHAR},
</if>
<if test="parkAreaCode != null">
park_area_code = #{parkAreaCode,jdbcType=VARCHAR},
</if>
<if test="berthNo != null">
berth_no = #{berthNo,jdbcType=VARCHAR},
</if>
<if test="carNo != null">
car_no = #{carNo,jdbcType=VARCHAR},
</if>
<if test="orderId != null">
order_id = #{orderId,jdbcType=VARCHAR},
</if>
<if test="isOccupy != null">
is_occupy = #{isOccupy,jdbcType=CHAR},
</if>
<if test="roadPosition != null">
road_position = #{roadPosition,jdbcType=CHAR},
</if>
<if test="direction != null">
direction = #{direction,jdbcType=CHAR},
</if>
<if test="parkType != null">
park_type = #{parkType,jdbcType=CHAR},
</if>
<if test="berthAddress != null">
berth_address = #{berthAddress,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="dataState != null">
data_state = #{dataState,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="carStatus != null">
car_status = #{carStatus,jdbcType=VARCHAR},
</if>
<if test="createOp != null">
create_op = #{createOp,jdbcType=BIGINT},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyOp != null">
modify_op = #{modifyOp,jdbcType=BIGINT},
</if>
<if test="optFlg != null">
opt_flg = #{optFlg,jdbcType=CHAR},
</if>
<if test="pdaInTime != null">
pda_in_time = #{pdaInTime,jdbcType=TIMESTAMP},
</if>
<if test="eqpInTime != null">
eqp_in_time = #{eqpInTime,jdbcType=TIMESTAMP},
</if>
<if test="eqpOutTime != null">
eqp_out_time = #{eqpOutTime,jdbcType=TIMESTAMP},
</if>
<if test="pdaOutTime != null">
pda_out_time = #{pdaOutTime,jdbcType=TIMESTAMP},
</if>
<if test="payStatus != null">
pay_status = #{payStatus,jdbcType=VARCHAR},
</if>
<if test="carNumberColor != null">
car_number_color = #{carNumberColor,jdbcType=INTEGER},
</if>
</set>
where pl_no = #{plNo} and berth_no = #{berthNo} and (order_id is null or order_id = '')
</update>
<update id="updateBerthEqpOutTime" parameterType="com.zteits.clouds.api.dto.pda.param.UpdateBerthRequest">
update tp_p_berths
set eqp_out_time = null
where pl_no = #{plNo} and berth_no = #{berthNo}
</update>
<update id="updateBerthInfoByPDA" parameterType="com.zteits.clouds.api.dto.pda.param.UpdateBerthByOrderIdRequest">
update tp_p_berths
<set>
<if test="carNo != null">
car_no = #{carNo,jdbcType=VARCHAR},
</if>
<if test="carNumberColor != null">
car_number_color = #{carNumberColor,jdbcType=INTEGER},
</if>
</set>
where order_id = #{orderId} and data_state = 1
</update>
<select id="qyeryParkAreaBerthNumstatistic" resultType="com.zteits.clouds.api.dto.rocketmq.datacollection.freeberths.ParkAreaFreeBerthsMsgVO">
SELECT
park_area_code parkAreaCode,
sum(case when is_occupy = 2 then 1 else 0 end) freeBerth,
count(1) totalBerth
FROM tp_p_berths a
WHERE a.data_state = 1 AND a.pl_no = #{plNo}
group by park_area_code
</select>
<!-- 根据排班的停车场编号列表以及泊位号模糊查询对应的泊位信息 -->
<select id="queryBerthInfoByKeyWord" resultType="com.zteits.clouds.api.dto.park.dto.BerthsDTO">
select
b.pl_no as plNo,
b.park_area_code as parkAreaCode,
b.berth_no as berthNo,
r.park_area_name as parkAreaName
FROM (
SELECT
a.pl_no,
a.park_area_code,
a.berth_no
FROM tp_p_berths a
where a.data_state = 1
and a.berth_no like concat('%',#{berthNo,jdbcType=VARCHAR},'%')
and a.pl_no in
<foreach collection="plNos" separator="," open="(" close=")" item="plNo" index="index">
#{plNo}
</foreach>
) b
LEFT JOIN
tp_p_region_area r
ON r.pl_no = b.pl_no and r.park_area_code = b.park_area_code
</select>
<!-- 自助停车 验证泊位号 -->
<select id="queryBerthsByBerthNo" resultType="com.zteits.clouds.api.dto.park.dto.BerthsDTO">
select
t.id as id,
t.pl_no as plNo,
t.park_area_code as parkAreaCode,
t.berth_no as berthNo,
t.car_no as carNo,
t.order_id as orderId,
t.is_occupy as isOccupy,
t.road_position as roadPosition,
t.direction as direction,
t.park_type as parkType,
t.berth_address as berthAddress,
t.remark as remark,
t.data_state as dataState,
t.create_time as createTime,
t.car_status as carStatus,
t.create_op as createOp,
t.modify_time as modifyTime,
t.modify_op as modifyOp,
t.opt_flg as optFlg,
t.pda_in_time as pdaInTime,
t.eqp_in_time as eqpInTime,
t.eqp_out_time as eqpOutTime,
t.pda_out_time as pdaOutTime,
t.pay_status as payStatus,
t.car_number_color as carNumberColor
from tp_p_berths t
where t.data_state = 1
and t.berth_no = #{berthNo}
limit 1
</select>
</mapper>