Commit 9b9a2a94 authored by zhoushiguang's avatar zhoushiguang

路口缓行事件计算

parent 11b321ea
......@@ -451,4 +451,34 @@
start_time DESC
</select>
<!-- 路口缓行时间数据插入(5分钟粒度):路口有2个及以上方向发生了拥堵则计为路口发生缓行-->
<insert id="insertCrossSlowRunEventData" parameterType="map">
INSERT INTO t_analysis_cross_slow_run_event ( cross_id, dir, start_time, end_time, dt, insert_time )
SELECT
cross_id,
concat( '[', GROUP_CONCAT( dir_type ), ']' ) dir,
start_time,
DATE_ADD( start_time, INTERVAL 5 MINUTE ) AS end_time,
dt,
now()
FROM
t_cross_dir_data_hist
WHERE
start_time >= #{startTime} and start_time &lt; #{endTime}
AND `status` = 2
GROUP BY
cross_id,
start_time
HAVING
count(*)>=2
ON DUPLICATE KEY UPDATE
cross_id=values(cross_id),
dir=values(dir),
start_time=values(start_time),
end_time=values(end_time),
dt=values(dt),
insert_time=values(insert_time)
</insert>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment