|
@ -39,19 +39,25 @@ |
|
|
</where> |
|
|
</where> |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectSectionPerceivedEventsList" resultType="hashmap"> |
|
|
<select id="selectSectionPerceivedEventsList" resultType="hashmap"> |
|
|
SELECT COUNT(1) as number,section.section_name sectionName FROM dc_warning AS warning |
|
|
select s.section_name sectionName, |
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
(select COUNT(1) FROM `dc_warning` as w where |
|
|
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id |
|
|
DATE_FORMAT(w.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d') |
|
|
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d') |
|
|
and mark.stake_mark=w.stake_mark)number from dc_warning as w |
|
|
group by section.section_name |
|
|
left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark |
|
|
|
|
|
LEFT JOIN dc_road_section as s ON mark.section_id=s.id |
|
|
|
|
|
where mark.stake_mark is not null |
|
|
|
|
|
group by w.stake_mark |
|
|
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 COUNT(1) as number,section.section_name sectionName FROM dc_warning AS warning |
|
|
select s.section_name sectionName, |
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
(select COUNT(1) FROM `dc_warning` as w where |
|
|
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id |
|
|
DATE_FORMAT(w.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d') |
|
|
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d') |
|
|
and mark.stake_mark=w.stake_mark)number from dc_warning as w |
|
|
group by section.section_name |
|
|
left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark |
|
|
|
|
|
LEFT JOIN dc_road_section as s ON mark.section_id=s.id |
|
|
|
|
|
where mark.stake_mark is not null |
|
|
|
|
|
group by w.stake_mark |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectDailyCumulative" resultType="java.util.HashMap"> |
|
|
<select id="selectDailyCumulative" resultType="java.util.HashMap"> |
|
|
SELECT DATE_FORMAT(create_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number |
|
|
SELECT DATE_FORMAT(create_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number |
|
@ -168,20 +174,14 @@ |
|
|
GROUP BY warning_type |
|
|
GROUP BY warning_type |
|
|
ORDER BY number DESC |
|
|
ORDER BY number DESC |
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningSectionTypeQuarterCount" resultType="hashmap"> |
|
|
<select id="selectWarningSectionTypeQuarterCount" resultType="string"> |
|
|
SELECT |
|
|
SELECT |
|
|
CASE |
|
|
COUNT(*) AS number |
|
|
WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度' |
|
|
|
|
|
WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度' |
|
|
|
|
|
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度' |
|
|
|
|
|
ELSE '第四季度' |
|
|
|
|
|
END AS QUARTER,COUNT(*) AS number |
|
|
|
|
|
FROM dc_warning as warning |
|
|
FROM dc_warning as warning |
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y') |
|
|
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y') |
|
|
AND warning.direction=#{direction} |
|
|
AND warning.direction=#{direction} |
|
|
and mark.`section_id`=#{sectionId} |
|
|
and mark.`section_id`=#{sectionId} |
|
|
GROUP BY QUARTER |
|
|
|
|
|
</select> |
|
|
</select> |
|
|
<select id="selectWarningSectionTypeQuarter" resultType="java.util.HashMap"> |
|
|
<select id="selectWarningSectionTypeQuarter" resultType="java.util.HashMap"> |
|
|
SELECT |
|
|
SELECT |
|
@ -278,7 +278,7 @@ |
|
|
END AS QUARTER |
|
|
END AS QUARTER |
|
|
from dc_warning where stake_mark=#{stakeMark} and |
|
|
from dc_warning where stake_mark=#{stakeMark} and |
|
|
YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y') |
|
|
YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y') |
|
|
AND direction=#{direction} |
|
|
AND direction=#{direction} and stake_mark is not null |
|
|
GROUP BY QUARTER |
|
|
GROUP BY QUARTER |
|
|
ORDER BY QUARTER; |
|
|
ORDER BY QUARTER; |
|
|
</select> |
|
|
</select> |
|
@ -286,5 +286,30 @@ |
|
|
select count(1) from dc_warning |
|
|
select count(1) from dc_warning |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectWarningMarkQuarterOptimize" resultType="java.util.HashMap"> |
|
|
|
|
|
SELECT count( 1 ) sectionNumber, |
|
|
|
|
|
CASE |
|
|
|
|
|
WHEN MONTH ( w.create_time ) BETWEEN 1 AND 3 THEN '第一季度' |
|
|
|
|
|
WHEN MONTH ( w.create_time ) BETWEEN 4 AND 6 THEN '第二季度' |
|
|
|
|
|
WHEN MONTH ( w.create_time ) BETWEEN 7 AND 9 THEN '第三季度' |
|
|
|
|
|
ELSE '第四季度' |
|
|
|
|
|
END AS QUARTER |
|
|
|
|
|
FROM dc_warning w |
|
|
|
|
|
LEFT JOIN dc_stake_mark m ON w.stake_mark = m.stake_mark |
|
|
|
|
|
WHERE m.stake_mark IS NOT null and w.direction=#{direction} |
|
|
|
|
|
and YEAR(w.create_time) =DATE_FORMAT(#{createTime},'%Y') |
|
|
|
|
|
GROUP BY QUARTER |
|
|
|
|
|
ORDER BY QUARTER; |
|
|
|
|
|
</select> |
|
|
|
|
|
<select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap"> |
|
|
|
|
|
SELECT DISTINCT m.stake_mark stakeMarkId, |
|
|
|
|
|
(SELECT count( 0 ) FROM dc_warning w WHERE w.stake_mark = m.stake_mark |
|
|
|
|
|
<if test = 'type == "day"' >and DATE(w.create_time)= DATE_FORMAT(#{createTime},'%Y-%m-%d')</if> |
|
|
|
|
|
<if test = 'type == "month"' >and DATE_FORMAT(w.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')</if> |
|
|
|
|
|
<if test = 'type == "year"' >and YEAR(w.create_time) =DATE_FORMAT(#{createTime},'%Y')</if> |
|
|
|
|
|
AND w.direction = #{direction}) sectionNumber FROM dc_stake_mark AS m |
|
|
|
|
|
WHERE m.section_id = #{sectionId} |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper> |
|
|
</mapper> |