ParkFreeBerthSMapper.xml
5.99 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
<?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.ParkFreeBerthSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.ParkFreeBerth">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="pl_id" jdbcType="BIGINT" property="plId"/>
<result column="pl_name" jdbcType="VARCHAR" property="plName"/>
<result column="pl_no" jdbcType="VARCHAR" property="plNo"/>
<result column="free_berth" jdbcType="INTEGER" property="freeBerth"/>
<result column="data_status" jdbcType="INTEGER" property="dataStatus"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
</resultMap>
<sql id="Base_Column_List">
id, pl_id, pl_name, pl_no, free_berth, data_status, modify_time, type
</sql>
<!-- 通过区县分组获取空闲车位统计信息 -->
<select id="StatisticParkFreeBerthsCountByCountry"
resultType="com.zteits.park.domain.ParkFreeBerthsCountStatisticByCountryDO">
SELECT
lot.pl_city_id as plCityId,
lot.pl_city_name as plCityName,
lot.pl_country_id as plCountryId,
lot.pl_country_name as plCountryName,
sum(free.free_berth) as freeBerthsNum
FROM
park_free_berth free
JOIN parking_lot lot ON free.pl_no= lot.pl_no
WHERE
lot.data_status = 1
and free.data_status =1
<if test="cityId!=null and cityId!=''">
AND lot.pl_city_id = #{cityId}
</if>
<if test="state!=null">
AND lot.state = #{state}
</if>
group by lot.pl_city_id,lot.pl_city_name,lot.pl_country_id,lot.pl_country_name;
</select>
<select id="queryAllFreeBerthNum" resultType="java.lang.Integer">
SELECT
ifnull(sum(case when free_berth is null THEN
0
else
free_berth
end),0)
FROM park_free_berth
where 1=1
and pl_no in
<foreach collection="plnos" item="plno" index="index" open="(" close=")" separator=",">
#{plno}
</foreach>
</select>
<select id="getParkingBerthInfo" resultType="com.zteits.park.domain.BerthInfoDO">
SELECT
ifnull(totalBerthNum,0) totalBerthNum,
ifnull(totalFreeBerthNum,0) totalFreeBerthNum
FROM
(select sum(pl_berth_num) totalBerthNum from parking_lot where
1=1
<if test="userAreaInfoList != null and userAreaInfoList.size>0">
or pl_province_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl_city_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl_country_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl_area_block_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
</if>
) totalBerthNum,
(select sum(free_berth) totalFreeBerthNum from park_free_berth
where pl_id in(select pl_id from parking_lot
where
1=1
<if test="userAreaInfoList != null and userAreaInfoList.size>0">
or pl_province_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl_city_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl_country_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl_area_block_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
</if>
))totalFreeBerthNum
</select>
<select id="getZeroBerthParkinglotList" resultType="com.zteits.park.domain.ZeroBerthParkingLotDO">
select
pl.pl_name parkinglotName,
g.lon_id longitude,
g.lat_id latitude
from parking_lot pl left join parking_lot_geo g on g.pl_id=pl.pl_id and g.geo_type =1
where g.pl_no in(select pl_no from park_free_berth where free_berth=0) and g.lon_id is not null and g.lat_id is not null
<if test="userAreaInfoList != null and userAreaInfoList.size>0">
and(pl.pl_province_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl.pl_city_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl.pl_country_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
or pl.pl_area_block_id in
<foreach collection="userAreaInfoList" item="userAreaInfo" index="index" open="(" close=")" separator=",">
#{userAreaInfo.areaId, jdbcType=VARCHAR}
</foreach>
)
</if>
</select>
</mapper>