|
|
@ -171,6 +171,111 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
group by event_subclass) t3 |
|
|
|
on t1.event_subclass = t3.event_subclass |
|
|
|
</select> |
|
|
|
<select id="accidentSectionAnalysis" resultType="java.util.HashMap"> |
|
|
|
SELECT stake_mark stakeMark FROM `dc_sdhs_event` |
|
|
|
<where> |
|
|
|
<if test="type != null and type == '0'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '1'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '2'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{thisTime} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
<select id="accidentTypeAnalysis" resultType="java.util.HashMap"> |
|
|
|
SELECT e.event_type AS eventType, |
|
|
|
IFNULL(t1.num, 0) AS thisTimeList, |
|
|
|
IFNULL(t2.num, 0) AS lastTimeList |
|
|
|
FROM `dc_sdhs_event` e |
|
|
|
LEFT JOIN (SELECT event_type, |
|
|
|
COUNT(*) AS num FROM |
|
|
|
`dc_sdhs_event` |
|
|
|
<where> |
|
|
|
<if test="type != null and type == '0'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '1'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '2'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{thisTime} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY event_type ) t1 ON e.event_type = t1.event_type |
|
|
|
LEFT JOIN (SELECT |
|
|
|
event_type, COUNT(*) AS num |
|
|
|
FROM `dc_sdhs_event` |
|
|
|
<where> |
|
|
|
<if test="type != null and type == '0'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y') = #{lastTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '1'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m') = #{lastTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '2'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{lastTime} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY event_type ) t2 ON e.event_type = t2.event_type |
|
|
|
GROUP BY e.event_type; |
|
|
|
</select> |
|
|
|
<select id="accidentCongestedTime" resultType="com.zc.business.domain.DcSdhsEvent"> |
|
|
|
SELECT stake_mark stakeMark,start_time startTime,end_time endTime,event_type eventType FROM `dc_sdhs_event` |
|
|
|
<where> |
|
|
|
event_type='交通拥堵' |
|
|
|
<if test="type != null and type == '0'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '1'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '2'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{thisTime} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
<select id="accidentCongestedLocation" resultType="java.util.HashMap"> |
|
|
|
SELECT |
|
|
|
e.event_subclass AS eventSubclass, |
|
|
|
IFNULL(t1.num, 0) AS thisTimeList, |
|
|
|
IFNULL(t2.num, 0) AS lastTimeList |
|
|
|
FROM `dc_sdhs_event` e |
|
|
|
LEFT JOIN (SELECT event_subclass, COUNT(*) AS num |
|
|
|
FROM `dc_sdhs_event` |
|
|
|
<where> |
|
|
|
<if test="type != null and type == '0'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '1'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m') = #{thisTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '2'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{thisTime} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY event_subclass ) t1 ON e.event_subclass = t1.event_subclass |
|
|
|
LEFT JOIN |
|
|
|
(SELECT event_subclass, COUNT(*) AS num |
|
|
|
FROM `dc_sdhs_event` |
|
|
|
<where> |
|
|
|
<if test="type != null and type == '0'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y') = #{lastTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '1'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m') = #{lastTime} |
|
|
|
</if> |
|
|
|
<if test="type != null and type == '2'.toString"> |
|
|
|
and DATE_FORMAT(start_time,'%Y-%m-%d') = #{lastTime} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY event_subclass |
|
|
|
) t2 ON e.event_subclass = t2.event_subclass |
|
|
|
where e .event_type='交通拥堵' |
|
|
|
GROUP BY e.event_subclass; |
|
|
|
</select> |
|
|
|
<select id="getDataCalendar" resultType="java.lang.String"> |
|
|
|
SELECT DATE_FORMAT(start_time,'%Y-%m-%d') dateTime |
|
|
|
FROM `dc_sdhs_event` |
|
|
|