|
@ -46,29 +46,42 @@ |
|
|
order by warning.warning_time desc |
|
|
order by warning.warning_time desc |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectSectionPerceivedEventsList" resultType="hashmap"> |
|
|
<select id="selectSectionPerceivedEventsList" resultType="hashmap"> |
|
|
select s.section_name sectionName,COUNT(1) number from dc_warning as w |
|
|
SELECT s.section_name AS sectionName, COALESCE(w_count.number, 0) AS number2 |
|
|
left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark and mark.direction=w.direction |
|
|
FROM dc_road_section AS s |
|
|
LEFT JOIN dc_road_section as s ON mark.section_id=s.id |
|
|
LEFT JOIN ( SELECT mark.section_id, COUNT(1) AS number FROM dc_warning AS w JOIN |
|
|
where mark.stake_mark is not null and DATE_FORMAT(w.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
dc_stake_mark AS mark ON mark.stake_mark = w.stake_mark AND mark.direction = w.direction |
|
|
group by sectionName |
|
|
WHERE mark.stake_mark IS NOT NULL AND DATE_FORMAT(w.warning_time, '%Y-%m-%d') = DATE_FORMAT(#{warningTime}, '%Y-%m-%d') |
|
|
HAVING number !=0 |
|
|
GROUP BY mark.section_id ) AS w_count ON s.id = w_count.section_id |
|
|
order by number desc |
|
|
ORDER BY number DESC; |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectSectionPerceivedNumber" resultType="java.util.HashMap"> |
|
|
<select id="selectSectionPerceivedNumber" resultType="java.util.HashMap"> |
|
|
select s.section_name sectionName, COUNT(1) number from dc_warning as w |
|
|
SELECT s.section_name AS sectionName, COALESCE(w_count.number, 0) AS number2 |
|
|
left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark and mark.direction=w.direction |
|
|
FROM dc_road_section AS s |
|
|
LEFT JOIN dc_road_section as s ON mark.section_id=s.id |
|
|
LEFT JOIN ( SELECT mark.section_id, COUNT(1) AS number FROM dc_warning AS w JOIN |
|
|
where mark.stake_mark is not null and DATE_FORMAT(w.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
dc_stake_mark AS mark ON mark.stake_mark = w.stake_mark AND mark.direction = w.direction |
|
|
group by sectionName |
|
|
WHERE mark.stake_mark IS NOT NULL AND DATE_FORMAT(w.warning_time, '%Y-%m-%d') = DATE_FORMAT(#{warningTime}, '%Y-%m-%d') |
|
|
HAVING number !=0 |
|
|
GROUP BY mark.section_id ) AS w_count ON s.id = w_count.section_id |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectDailyCumulative" resultType="java.util.HashMap"> |
|
|
<select id="selectDailyCumulative" resultType="java.util.HashMap"> |
|
|
SELECT DATE_FORMAT(warning_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number |
|
|
SELECT |
|
|
FROM dc_warning |
|
|
DATE_FORMAT(CURDATE() + INTERVAL a.a HOUR, '%Y-%m-%d %H') AS time, |
|
|
WHERE warning_time >= CURDATE() AND warning_time <![CDATA[<]]> CURDATE() + INTERVAL 1 DAY |
|
|
COALESCE(COUNT(dw.warning_time), 0) AS number |
|
|
|
|
|
FROM ( |
|
|
|
|
|
SELECT 0 AS a |
|
|
|
|
|
UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 |
|
|
|
|
|
UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 |
|
|
|
|
|
UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 |
|
|
|
|
|
UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 |
|
|
|
|
|
UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL SELECT 15 |
|
|
|
|
|
UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 |
|
|
|
|
|
UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 |
|
|
|
|
|
UNION ALL SELECT 22 UNION ALL SELECT 23 |
|
|
|
|
|
) AS a |
|
|
|
|
|
LEFT JOIN dc_warning dw ON DATE_FORMAT(dw.warning_time, '%Y-%m-%d %H') |
|
|
|
|
|
= DATE_FORMAT(CURDATE() + INTERVAL a.a HOUR, '%Y-%m-%d %H') |
|
|
GROUP BY time |
|
|
GROUP BY time |
|
|
ORDER BY time |
|
|
ORDER BY time; |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectDailyCumulativeMonth" resultType="java.util.HashMap"> |
|
|
<select id="selectDailyCumulativeMonth" resultType="java.util.HashMap"> |
|
|
SELECT HOUR(warning_time) AS time, COUNT(*) AS number |
|
|
SELECT HOUR(warning_time) AS time, COUNT(*) AS number |
|
@ -106,13 +119,22 @@ |
|
|
ORDER BY number DESC |
|
|
ORDER BY number DESC |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningTrendDay" resultType="java.util.HashMap"> |
|
|
<select id="selectWarningTrendDay" resultType="java.util.HashMap"> |
|
|
SELECT DATE_FORMAT(warning.warning_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number |
|
|
select t1.n as time,IFNULL(t2.num,0)as number from |
|
|
FROM dc_warning AS warning |
|
|
(SELECT 0 AS n UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL |
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL |
|
|
WHERE DATE_FORMAT(warning.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL |
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL |
|
|
AND mark.`section_id`=#{sectionId} |
|
|
SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 UNION ALL SELECT 19 UNION ALL |
|
|
GROUP BY time |
|
|
SELECT 20 UNION ALL SELECT 21 UNION ALL SELECT 22 UNION ALL SELECT 23 |
|
|
|
|
|
) t1 |
|
|
|
|
|
left join |
|
|
|
|
|
(select HOUR(warning_time) hours,count(*) num from dc_warning t1 |
|
|
|
|
|
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark |
|
|
|
|
|
and t1.direction = t2.direction where date_format(warning_time,'%Y-%m-%d') = date_format(#{warningTime},'%Y-%m-%d') |
|
|
|
|
|
and t2.section_id = #{sectionId} |
|
|
|
|
|
and t1.direction=#{direction} and t2.direction=#{direction} |
|
|
|
|
|
GROUP BY hours) t2 |
|
|
|
|
|
on t1.n = t2.hours |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningTrendMonth" resultType="java.util.HashMap"> |
|
|
<select id="selectWarningTrendMonth" resultType="java.util.HashMap"> |
|
|
SELECT DATE(warning.warning_time) AS day, COUNT(*) AS number |
|
|
SELECT DATE(warning.warning_time) AS day, COUNT(*) AS number |
|
@ -138,12 +160,17 @@ |
|
|
|
|
|
|
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningTrendYear" resultType="java.util.HashMap"> |
|
|
<select id="selectWarningTrendYear" resultType="java.util.HashMap"> |
|
|
SELECT month(warning.warning_time) AS month, COUNT(*) AS number |
|
|
select t1.n as month,IFNULL(t2.num,0)as number from |
|
|
FROM dc_warning as warning |
|
|
(SELECT 0 AS n UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL |
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL |
|
|
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL |
|
|
and DATE_FORMAT(warning.warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') |
|
|
SELECT 12 |
|
|
GROUP BY month |
|
|
) t1 left join |
|
|
|
|
|
(select month(warning_time) hours,count(*) num from dc_warning t1 |
|
|
|
|
|
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction where |
|
|
|
|
|
DATE_FORMAT(t1.warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') and t2.section_id =#{sectionId} |
|
|
|
|
|
and t1.direction=#{direction} and t2.direction=#{direction} GROUP BY hours) t2 |
|
|
|
|
|
on t1.n = t2.hours |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningSectionTypeDayCount" resultType="java.lang.String"> |
|
|
<select id="selectWarningSectionTypeDayCount" resultType="java.lang.String"> |
|
|
SELECT COUNT(*) AS number FROM dc_warning as warning |
|
|
SELECT COUNT(*) AS number FROM dc_warning as warning |
|
@ -287,12 +314,10 @@ |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="selectWarningMarkQuarterOptimize" resultType="java.util.HashMap"> |
|
|
<select id="selectWarningMarkQuarterOptimize" resultType="java.util.HashMap"> |
|
|
SELECT count( 1 ) sectionNumber,m.stake_mark stakeMarkId |
|
|
SELECT DISTINCT m.stake_mark AS stakeMarkId,COALESCE(wc.count, 0) AS sectionNumber |
|
|
FROM dc_warning w |
|
|
FROM dc_stake_mark AS m LEFT JOIN ( SELECT stake_mark, COUNT(0) AS count FROM dc_warning WHERE |
|
|
LEFT JOIN dc_stake_mark m ON w.stake_mark = m.stake_mark and m.direction=w.direction |
|
|
QUARTER(warning_time) =#{quarter} AND direction = #{direction} GROUP BY stake_mark ) AS wc |
|
|
WHERE m.stake_mark IS NOT null and w.direction=#{direction} |
|
|
ON m.stake_mark = wc.stake_mark WHERE m.section_id = #{sectionId} |
|
|
and QUARTER(w.warning_time)=#{quarter} and m.`section_id`=#{sectionId} |
|
|
|
|
|
GROUP BY stakeMarkId |
|
|
|
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap"> |
|
|
<select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap"> |
|
|
SELECT DISTINCT m.stake_mark AS stakeMarkId,COALESCE(wc.count, 0) AS sectionNumber FROM |
|
|
SELECT DISTINCT m.stake_mark AS stakeMarkId,COALESCE(wc.count, 0) AS sectionNumber FROM |
|
@ -303,7 +328,6 @@ |
|
|
<if test = 'type == "year"' > YEAR(warning_time) =DATE_FORMAT(#{warningTime},'%Y')</if> |
|
|
<if test = 'type == "year"' > YEAR(warning_time) =DATE_FORMAT(#{warningTime},'%Y')</if> |
|
|
AND direction = #{direction} GROUP BY stake_mark ) AS wc ON m.stake_mark = wc.stake_mark |
|
|
AND direction = #{direction} GROUP BY stake_mark ) AS wc ON m.stake_mark = wc.stake_mark |
|
|
WHERE m.section_id = #{sectionId} |
|
|
WHERE m.section_id = #{sectionId} |
|
|
HAVING sectionNumber != 0; |
|
|
|
|
|
</select> |
|
|
</select> |
|
|
<!-- <select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap">--> |
|
|
<!-- <select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap">--> |
|
|
<!-- SELECT DISTINCT m.stake_mark stakeMarkId,--> |
|
|
<!-- SELECT DISTINCT m.stake_mark stakeMarkId,--> |
|
|