InOutParkSMapper.xml
2.5 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
<?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.InOutParkSMapper">
<!-- 在场数据 -->
<sql id="inParkLotData">
SELECT
i.pl_no AS plNo,
i.pl_name AS parkName,
i.vpl_number AS carNumber,
i.in_out_status AS inOutState,
i.in_time AS inTime,
i.record_id AS recordId,
NULL outTime,
NULL parkingDuration,
i.is_fixed_car as isFixedCar
FROM
inpark_log i
WHERE
i.in_out_status = 1
<if test="beginTime != null">
<![CDATA[AND i.in_time >=#{beginTime} ]]>
</if>
<if test="plNos != null">
and i.pl_no IN
<foreach collection="plNos" open="(" close=")" separator="," item="plNo">
#{plNo}
</foreach>
</if>
<if test="isFixedCar != null">
<![CDATA[AND i.is_fixed_car in (#{isFixedCar},'-1') ]]>
</if>
</sql>
<!-- 出场数据 -->
<sql id="outParkLotData">
SELECT
o.pl_no AS plNo,
o.pl_name AS parkName,
o.vpl_number AS carNumber,
NULL inOutState,
o.in_time AS inTime,
o.record_id AS recordId,
o.out_time AS outTime,
o.parking_duration as parkingDuration,
o.is_fixed_car as isFixedCar
FROM
outpark_log o
WHERE
1=1
<if test="beginTime != null">
<![CDATA[AND o.in_time >=#{beginTime} ]]>
</if>
<if test="endTime != null">
<![CDATA[ AND o.out_time <=#{endTime} ]]>
</if>
<if test="plNos != null">
and o.pl_no IN
<foreach collection="plNos" open="(" close=")" separator="," item="plNo">
#{plNo}
</foreach>
</if>
<if test="isFixedCar != null">
<![CDATA[AND o.is_fixed_car in (#{isFixedCar},'-1') ]]>
</if>
</sql>
<!--查询企业云平台->数据统计->进出场统计 -->
<select id="queryInOutParkForList" resultType="com.zteits.park.domain.InOutParkDO">
select t.plNo ,t.parkName,t.carNumber,t.inOutState,t.inTime, t.recordId ,t.outTime,t.parkingDuration,t.isFixedCar
from (
<choose>
<when test="inOutStatus == null">
<include refid="inParkLotData" />
union all
<include refid="outParkLotData" />
</when>
<!-- 在场数据 -->
<when test="inOutStatus == 1">
<include refid="inParkLotData" />
</when>
<!-- 离场数据 -->
<when test="inOutStatus == 2">
<include refid="outParkLotData" />
</when>
</choose>
)t order by t.inTime desc
</select>
</mapper>