FlowMapper.xml
3.56 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
<?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.fanxing.query.mapper.FlowMapper">
<resultMap id="dataMap" type="com.viontech.fanxing.query.model.TrafficFlowDataModel">
<result column="flow_event_id" property="eventId"/>
<result column="event_time" property="eventTime"/>
<result column="road" property="road"/>
<result column="device_name" property="deviceName"/>
<result column="location_name" property="locationName"/>
<result column="velocity" property="velocity"/>
<result column="occupy" property="occupy"/>
<result column="distance" property="distance"/>
<result column="sample_dura" property="sampleDura"/>
<result column="queue_length" property="queueLength"/>
<result column="sample_num" property="sampleNum"/>
<result column="direction" property="direction"/>
<result column="time_occupy" property="timeOccupy"/>
<result column="dist_time" property="distTime"/>
</resultMap>
<select id="counts" parameterType="com.viontech.fanxing.query.model.TrafficFlowRequestVo"
resultType="java.lang.Integer">
select count(*) as count from (
select 1
from d_flow_event te,
d_flow_data td
<where>
te.id = td.flow_event_id
AND td.road_code != '0'
<if test="task_id != null and task_id != ''">
and te.task_id = #{task_id}
</if>
<if test="vchan_refid != null and vchan_refid != ''">
and te.channel_unid = #{vchan_refid}
</if>
<if test="detection_type != null and detection_type.size > 0">
and detection_type in
<foreach item="item" index="index" collection="detection_type" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="event_dt__gte != null and event_dt__lt != null">
and te.event_time <![CDATA[>=]]> #{event_dt__gte}
and te.event_time <![CDATA[<=]]> #{event_dt__lt}
</if>
</where>
GROUP BY ${groupByClause}
) as con
</select>
<select id="flowstatistics" parameterType="com.viontech.fanxing.query.model.TrafficFlowRequestVo"
resultMap="dataMap">
select ${column_List}
from d_flow_event te,
d_flow_data td
<where>
te.id = td.flow_event_id
and road_code != '0'
<if test="event_dt__gte != null and event_dt__lt != null">
and te.event_time <![CDATA[>=]]> #{event_dt__gte}
and te.event_time <![CDATA[<=]]> #{event_dt__lt}
</if>
<if test="task_id != null">
and td.task_id = #{task_id}
</if>
<if test="vchan_refid != null and vchan_refid != ''">
and te.channel_unid = #{vchan_refid}
</if>
<if test="detection_type != null and detection_type.size > 0">
and detection_type in
<foreach item="item" index="index" collection="detection_type" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY ${groupByClause}
ORDER BY ${orderByClause}
<if test="limit != null">
LIMIT #{offset},#{limit}
</if>
</select>
</mapper>