|
|
@ -3,7 +3,7 @@ |
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
|
|
<mapper namespace="com.zc.business.mapper.DcSdhsEventMapper"> |
|
|
|
|
|
|
|
|
|
|
|
<resultMap type="DcSdhsEvent" id="DcSdhsEventResult"> |
|
|
|
<result property="id" column="id" /> |
|
|
|
<result property="road" column="road" /> |
|
|
@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
|
|
|
<select id="selectDcSdhsEventList" parameterType="DcSdhsEvent" resultMap="DcSdhsEventResult"> |
|
|
|
<include refid="selectDcSdhsEventVo"/> |
|
|
|
<where> |
|
|
|
<where> |
|
|
|
<if test="road != null and road != ''"> and road = #{road}</if> |
|
|
|
<if test="dept != null and dept != ''"> and dept = #{dept}</if> |
|
|
|
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if> |
|
|
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="weather != null and weather != ''"> and weather = #{weather}</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectDcSdhsEventById" parameterType="Long" resultMap="DcSdhsEventResult"> |
|
|
|
<include refid="selectDcSdhsEventVo"/> |
|
|
|
where id = #{id} |
|
|
@ -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` |
|
|
@ -250,7 +355,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</delete> |
|
|
|
|
|
|
|
<delete id="deleteDcSdhsEventByIds" parameterType="String"> |
|
|
|
delete from dc_sdhs_event where id in |
|
|
|
delete from dc_sdhs_event where id in |
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|
|
|
#{id} |
|
|
|
</foreach> |
|
|
@ -276,4 +381,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</where> |
|
|
|
|
|
|
|
</select> |
|
|
|
</mapper> |
|
|
|
</mapper> |
|
|
|