TrafficEventMapper.xml
12.4 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
<?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.viontech.mapper.TrafficEventMapper">
<resultMap id="LaneResultMap" type="com.viontech.vo.traffic.LaneModel">
<result column="tollgate_id" jdbcType="VARCHAR" property="tollgateID"/>
<result column="lane_id" jdbcType="INTEGER" property="laneId"/>
<result column="lane_no" jdbcType="INTEGER" property="laneNo"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="direction" jdbcType="VARCHAR" property="direction"/>
<result column="ape_id" jdbcType="VARCHAR" property="apeID"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
</resultMap>
<resultMap id="DeviceResultMap" type="com.viontech.vo.traffic.DeviceModel">
<result column="ape_id" jdbcType="VARCHAR" property="apeID"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="ip_addr" jdbcType="VARCHAR" property="ipAddr"/>
<result column="port" jdbcType="INTEGER" property="port"/>
<result column="longitude" jdbcType="DECIMAL" property="longitude"/>
<result column="latitude" jdbcType="DECIMAL" property="latitude"/>
<result column="place_code" jdbcType="VARCHAR" property="placeCode"/>
<result column="is_online" jdbcType="VARCHAR" property="isOnline"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
</resultMap>
<resultMap id="TollgateResultMap" type="com.viontech.vo.traffic.TollgateModel">
<result column="tollgate_id" jdbcType="VARCHAR" property="tollgateID"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="longitude" jdbcType="DECIMAL" property="longitude"/>
<result column="latitude" jdbcType="DECIMAL" property="latitude"/>
<result column="place_code" jdbcType="VARCHAR" property="placeCode"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="tollgate_cat" jdbcType="VARCHAR" property="tollgateCat"/>
<result column="tollgate_usage" jdbcType="INTEGER" property="tollgateUsage"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
</resultMap>
<!-- fetchSize="5000" -->
<select id="selectJsonDatas" parameterType="com.viontech.vo.traffic.TrafficModel"
resultType="java.lang.String" fetchSize="5000">
<!-- select json_data from tb_traffic-->
select json_data
<!--||(select '{"unid":"'||unid||'"}' from tb_traffic as t1 where t1.unid=t2.unid )::jsonb as json_data -->
from tb_traffic as t2
<where>
<!-- <if test="event_type != null and (event_type == 'pedestrian' or event_type == 'xcycle')">-->
<if test="(sex != null and sex != '') or (upbody_color != null and upbody_color != '') or (lobody_color != null and lobody_color != '')">
and unid in(
select tb_face.traffic_unid
from tb_face where 1 = 1
<if test="sex != null and sex != ''">
and tb_face.sex = #{sex}
</if>
<if test="upbody_color != null and upbody_color != ''">
and tb_face.upbody_color = #{upbody_color}
</if>
<if test="lobody_color != null and lobody_color != ''">
and tb_face.lobody_color = #{lobody_color}
</if>)
</if>
<if test="subtaskIds != null and subtaskIds != ''">
and EXISTS(select 1
from (values
${subtaskIds}
) as tt(ids)
where tt.ids = tb_traffic.subtask_id)
</if>
<if test="event_type != null and event_type != ''">
and event_type = #{event_type}
</if>
<if test="with_hats != null">
and with_hats = #{with_hats}
</if>
<if test="event_types != null">
and event_type in
<foreach item="item" index="index" collection="event_types"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="task_id != null and task_id != ''">
and task_id = #{task_id}
</if>
<if test="subtask_id != null and subtask_id != ''">
and subtask_id = #{subtask_id}
</if>
<if test="plate_text != null and plate_text != ''">
and plate_text like '%' || #{plate_text} || '%'
</if>
<if test="task_type != null and task_type != ''">
and task_type = #{task_type}
</if>
<if test="dev_unid != null and dev_unid != ''">
and dev_unid = #{dev_unid}
</if>
<if test="vchan_refid != null and vchan_refid != ''">
and vchan_refid = #{vchan_refid}
</if>
<if test="xcycle_type != null and xcycle_type != ''">
and xcycle_type = #{xcycle_type}
</if>
<if test="vchan_duid != null and vchan_duid != ''">
and vchan_duid = #{vchan_duid}
</if>
<if test="plate_color_code != null and plate_color_code != ''">
and plate_color_code = #{plate_color_code}
</if>
<if test="location_code != null and location_code != ''">
and location_code = #{location_code}
</if>
<if test="lane_code != null and lane_code != ''">
and lane_code = #{lane_code}
</if>
<if test="direction_code != null and direction_code != ''">
and direction_code = #{direction_code}
</if>
<if test="location_name != null and location_name != ''">
and location_name = #{location_name}
</if>
<if test="body_type_code != null">
and body_type_code = #{body_type_code}
</if>
<if test="body_type_codes != null">
and body_type_code in
<foreach item="item" index="index" collection="body_type_codes"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="device_name != null and device_name != ''">
and device_name like '%' || #{device_name} || '%'
</if>
<if test="illegal_code != null and illegal_code != ''">
and illegal_code = #{illegal_code}
</if>
<if test="illegal_codes != null">
and illegal_code in
<foreach item="item" index="index" collection="illegal_codes"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="illegal_state != null">
and illegal_state = #{illegal_state}
</if>
<if test="body_color_code != null and body_color_code != ''">
and body_color_code = #{body_color_code}
</if>
<if test="body_logo_code != null and body_logo_code != ''">
and body_logo_code = #{body_logo_code}
</if>
<if test="refinedFeature_rAnnualInspection != null">
and "refinedFeature_rAnnualInspection" = #{refinedFeature_rAnnualInspection}
</if>
<if test="refinedFeature_rDecoration != null">
and "refinedFeature_rDecoration" = #{refinedFeature_rDecoration}
</if>
<if test="refinedFeature_rPendant != null">
and "refinedFeature_rPendant" = #{refinedFeature_rPendant}
</if>
<if test="refinedFeature_rSunshading != null">
and "refinedFeature_rSunshading" = #{refinedFeature_rSunshading}
</if>
<if test="company != null">
and "company" = #{company}
</if>
and is_active = 'true'
<if test="special_type != null and special_type != ''">
and special_type = #{special_type}
</if>
<if test="event_dt__gte != null and event_dt__gte != ''">
and shoot_dt > #{event_dt__gte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime >= #{event_dt__gte}-->
</if>
<if test="event_dt__lt != null and event_dt__lt != ''">
and shoot_dt <![CDATA[<=]]> #{event_dt__lt,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime <![CDATA[<]]> #{event_dt__lt}-->
</if>
</where>
order by shoot_dt asc
<if test="limit != null and offset != null">
LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<select id="selectDeviceDatas" parameterType="com.viontech.vo.traffic.DeviceModel"
resultMap="DeviceResultMap" fetchSize="5000">
select ape_id,name,model,ip_addr,port,longitude,latitude,place_code,is_online,create_time,modify_time
from tb_device
<where>
<if test="modifyTime_gte != null and modifyTime_gte != ''">
and modify_time > #{modifyTime_gte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime >= #{modifyTime_gte}-->
</if>
<if test="modifyTime_lte != null and modifyTime_lte != ''">
and modify_time <![CDATA[<=]]> #{modifyTime_lte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime <![CDATA[<]]> #{modifyTime_lte}-->
</if>
</where>
order by modify_time asc
<if test="limit != null and offset != null">
LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<select id="selectTollgateDatas" parameterType="com.viontech.vo.traffic.TollgateModel"
resultMap="TollgateResultMap" fetchSize="5000">
select tollgate_id,name,longitude,latitude,place_code,status,tollgate_cat,tollgate_usage,create_time,modify_time
from tb_tollgate
<where>
<if test="modifyTime_gte != null and modifyTime_gte != ''">
and modify_time > #{modifyTime_gte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime >= #{modifyTime_gte}-->
</if>
<if test="modifyTime_lte != null and modifyTime_lte != ''">
and modify_time <![CDATA[<=]]> #{modifyTime_lte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime <![CDATA[<]]> #{modifyTime_lte}-->
</if>
</where>
order by modify_time asc
<if test="limit != null and offset != null">
LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<select id="selectLaneDatas" parameterType="com.viontech.vo.traffic.LaneModel"
resultMap="LaneResultMap" fetchSize="5000">
select tollgate_id,lane_id,lane_no,name,direction,ape_id,create_time,modify_time
from tb_lane
<where>
<if test="modifyTime_gte != null and modifyTime_gte != ''">
and modify_time > #{modifyTime_gte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime >= #{modifyTime_gte}-->
</if>
<if test="modifyTime_lte != null and modifyTime_lte != ''">
and modify_time <![CDATA[<=]]> #{modifyTime_lte,typeHandler=com.viontech.handler.MilliDateTypeHandler}
<!-- and shoot_dtime <![CDATA[<]]> #{modifyTime_lte}-->
</if>
</where>
order by modify_time asc
<if test="limit != null and offset != null">
LIMIT #{limit} OFFSET #{offset}
</if>
</select>
</mapper>