|
|
@ -28,7 +28,7 @@ |
|
|
|
where warning.`id`=#{id} |
|
|
|
</select> |
|
|
|
<select id="selectPerceivedEventsList" resultType="com.zc.business.domain.DcWarning"> |
|
|
|
SELECT warning.`id`,warning.`stake_mark`, warning.`direction`, |
|
|
|
SELECT facility.facility_name, warning.`id`,warning.`stake_mark`, warning.`direction`,facility.facility_name, |
|
|
|
mark.longitude,mark.latitude,warning.lane,duration, |
|
|
|
warning.`dept_id`,warning.`warning_state`,warning.`warning_time`, |
|
|
|
warning.`user_id`, warning.`warning_source`,warning.`warning_level`, |
|
|
@ -36,8 +36,9 @@ |
|
|
|
warning.`warning_type`,warning.`warning_subclass`,warning.`warning_title`, |
|
|
|
warning.`other_config` FROM dc_warning AS warning |
|
|
|
left JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark and mark.direction=warning.direction |
|
|
|
left join dc_facility as facility on facility.stake_mark=warning.stake_mark |
|
|
|
<where> |
|
|
|
<if test="warningSource != null and warningSource != ''"> and warning.warning_source = #{warningSource}</if> |
|
|
|
warning.warning_source !=6 |
|
|
|
<if test="warningState != null and warningState != ''"> and warning.warning_state = #{warningState}</if> |
|
|
|
<if test="warningType != null and warningType != ''"> and warning.warning_type = #{warningType}</if> |
|
|
|
<if test="warningSubclass != null and warningSubclass != ''"> and warning.warning_subclass = #{warningSubclass}</if> |
|
|
@ -57,6 +58,37 @@ |
|
|
|
</where> |
|
|
|
order by warning.warning_time desc |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningList" resultType="com.zc.business.domain.DcWarning"> |
|
|
|
SELECT facility.facility_name, warning.`id`,warning.`stake_mark`, warning.`direction`,facility.facility_name, |
|
|
|
mark.longitude,mark.latitude,warning.lane,duration, |
|
|
|
warning.`dept_id`,warning.`warning_state`,warning.`warning_time`, |
|
|
|
warning.`user_id`, warning.`warning_source`,warning.`warning_level`, |
|
|
|
warning.`remark`, warning.`create_time`,warning.`update_time`, |
|
|
|
warning.`warning_type`,warning.`warning_subclass`,warning.`warning_title`, |
|
|
|
warning.`other_config` FROM dc_warning AS warning |
|
|
|
left JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark and mark.direction=warning.direction |
|
|
|
left join dc_facility as facility on facility.stake_mark=warning.stake_mark |
|
|
|
<where> |
|
|
|
<if test="warningSource != null and warningSource != ''"> and warning.warning_source = #{warningSource}</if> |
|
|
|
<if test="warningState != null and warningState != ''"> and warning.warning_state = #{warningState}</if> |
|
|
|
<if test="warningType != null and warningType != ''"> and warning.warning_type = #{warningType}</if> |
|
|
|
<if test="warningSubclass != null and warningSubclass != ''"> and warning.warning_subclass = #{warningSubclass}</if> |
|
|
|
<if test="direction != null and direction != ''"> and warning.direction = #{direction}</if> |
|
|
|
<if test="stakeMark != null and stakeMark != ''"> and warning.stake_mark = #{stakeMark}</if> |
|
|
|
<if test="startTime != null and completeTime != null "> |
|
|
|
and warning.warning_time between #{startTime} and #{completeTime}</if> |
|
|
|
<if test="startStakeMark != null and startStakeMark != ''"> |
|
|
|
and CAST(SUBSTRING(SUBSTRING_INDEX(warning.stake_mark,'+',1),2)AS UNSIGNED)*1000 |
|
|
|
+CAST(SUBSTRING_INDEX(warning.stake_mark, '+', -1) AS UNSIGNED)>#{startStakeMark} |
|
|
|
</if> |
|
|
|
<if test=" endStakeMark != null and endStakeMark != '' "> |
|
|
|
and CAST(SUBSTRING(SUBSTRING_INDEX(warning.stake_mark,'+',1),2)AS UNSIGNED)*1000 |
|
|
|
+CAST(SUBSTRING_INDEX(warning.stake_mark, '+', -1) AS UNSIGNED)<#{endStakeMark} |
|
|
|
</if> |
|
|
|
|
|
|
|
</where> |
|
|
|
order by warning.warning_time desc |
|
|
|
</select> |
|
|
|
<select id="selectWarningList" resultType="com.zc.business.domain.DcWarning"> |
|
|
|
SELECT warning.`id`,warning.`stake_mark`, warning.`direction`, |
|
|
|
mark.longitude,mark.latitude,warning.lane,duration, |
|
|
@ -372,6 +404,127 @@ |
|
|
|
AND direction = #{direction} and warning_source!=6 GROUP BY stake_mark ) AS wc ON m.stake_mark = wc.stake_mark |
|
|
|
WHERE m.section_id = #{sectionId} |
|
|
|
</select> |
|
|
|
<select id="selectTypeNonAutomaticWarningDay" resultType="java.util.HashMap"> |
|
|
|
SELECT s.subclass,COALESCE(t.count, 0) AS number |
|
|
|
FROM ( |
|
|
|
SELECT '1-1' AS warning_subclass , '拥堵' AS subclass UNION ALL |
|
|
|
SELECT '2-1' AS warning_subclass, '行人' AS subclass UNION ALL |
|
|
|
SELECT '6-4' AS warning_subclass, '抛洒物' AS subclass UNION ALL |
|
|
|
SELECT '5-6' AS warning_subclass, '变道' AS subclass UNION ALL |
|
|
|
SELECT '99-1' AS warning_subclass, '机占非' AS subclass UNION ALL |
|
|
|
SELECT '6-3' AS warning_subclass, '路障' AS subclass UNION ALL |
|
|
|
SELECT '7-1' AS warning_subclass, '施工' AS subclass UNION ALL |
|
|
|
SELECT '4-10' AS warning_subclass, '停车' AS subclass UNION ALL |
|
|
|
SELECT '5-2' AS warning_subclass, '压线' AS subclass UNION ALL |
|
|
|
SELECT '5-3' AS warning_subclass, '掉头' AS subclass UNION ALL |
|
|
|
SELECT '5-1' AS warning_subclass, '逆行' AS subclass |
|
|
|
) s |
|
|
|
LEFT JOIN ( SELECT warning_subclass, COUNT(1) AS count FROM dc_warning |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
|
and warning_source=6 |
|
|
|
GROUP BY warning_subclass) t ON s.warning_subclass = t.warning_subclass |
|
|
|
</select> |
|
|
|
<select id="selectTypeNonAutomaticWarningMonth" resultType="java.util.HashMap"> |
|
|
|
SELECT s.subclass,COALESCE(t.count, 0) AS number |
|
|
|
FROM ( |
|
|
|
SELECT '1-1' AS warning_subclass , '拥堵' AS subclass UNION ALL |
|
|
|
SELECT '2-1' AS warning_subclass, '行人' AS subclass UNION ALL |
|
|
|
SELECT '6-4' AS warning_subclass, '抛洒物' AS subclass UNION ALL |
|
|
|
SELECT '5-6' AS warning_subclass, '变道' AS subclass UNION ALL |
|
|
|
SELECT '99-1' AS warning_subclass, '机占非' AS subclass UNION ALL |
|
|
|
SELECT '6-3' AS warning_subclass, '路障' AS subclass UNION ALL |
|
|
|
SELECT '7-1' AS warning_subclass, '施工' AS subclass UNION ALL |
|
|
|
SELECT '4-10' AS warning_subclass, '停车' AS subclass UNION ALL |
|
|
|
SELECT '5-2' AS warning_subclass, '压线' AS subclass UNION ALL |
|
|
|
SELECT '5-3' AS warning_subclass, '掉头' AS subclass UNION ALL |
|
|
|
SELECT '5-1' AS warning_subclass, '逆行' AS subclass |
|
|
|
) s |
|
|
|
LEFT JOIN ( SELECT warning_subclass, COUNT(1) AS count FROM dc_warning |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m')=DATE_FORMAT(#{warningTime},'%Y-%m') |
|
|
|
and warning_source=6 |
|
|
|
GROUP BY warning_subclass) t ON s.warning_subclass = t.warning_subclass |
|
|
|
</select> |
|
|
|
<select id="selectTypeNonAutomaticWarningYear" resultType="java.util.HashMap"> |
|
|
|
SELECT s.subclass,COALESCE(t.count, 0) AS number |
|
|
|
FROM ( |
|
|
|
SELECT '1-1' AS warning_subclass , '拥堵' AS subclass UNION ALL |
|
|
|
SELECT '2-1' AS warning_subclass, '行人' AS subclass UNION ALL |
|
|
|
SELECT '6-4' AS warning_subclass, '抛洒物' AS subclass UNION ALL |
|
|
|
SELECT '5-6' AS warning_subclass, '变道' AS subclass UNION ALL |
|
|
|
SELECT '99-1' AS warning_subclass, '机占非' AS subclass UNION ALL |
|
|
|
SELECT '6-3' AS warning_subclass, '路障' AS subclass UNION ALL |
|
|
|
SELECT '7-1' AS warning_subclass, '施工' AS subclass UNION ALL |
|
|
|
SELECT '4-10' AS warning_subclass, '停车' AS subclass UNION ALL |
|
|
|
SELECT '5-2' AS warning_subclass, '压线' AS subclass UNION ALL |
|
|
|
SELECT '5-3' AS warning_subclass, '掉头' AS subclass UNION ALL |
|
|
|
SELECT '5-1' AS warning_subclass, '逆行' AS subclass |
|
|
|
) s |
|
|
|
LEFT JOIN ( SELECT warning_subclass, COUNT(1) AS count FROM dc_warning |
|
|
|
where DATE_FORMAT(warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') |
|
|
|
and warning_source=6 |
|
|
|
GROUP BY warning_subclass) t ON s.warning_subclass = t.warning_subclass |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningDay" resultType="java.util.HashMap"> |
|
|
|
select t1.n as time,IFNULL(t2.num,0)as number from |
|
|
|
(SELECT 0 AS n 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 |
|
|
|
) t1 |
|
|
|
left join |
|
|
|
(select HOUR(warning_time) hours,count(*) num from dc_warning |
|
|
|
where date_format(warning_time,'%Y-%m-%d') = date_format(#{warningTime},'%Y-%m-%d') |
|
|
|
and warning_source=6 |
|
|
|
GROUP BY hours) t2 |
|
|
|
on t1.n = t2.hours |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningMonth" resultType="java.util.HashMap"> |
|
|
|
SELECT DATE(warning.warning_time) AS day, COUNT(*) AS number |
|
|
|
FROM dc_warning as warning |
|
|
|
WHERE DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m') |
|
|
|
and warning_source=6 |
|
|
|
GROUP BY day |
|
|
|
ORDER BY day |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningYear" resultType="java.util.HashMap"> |
|
|
|
select t1.n as month,IFNULL(t2.num,0)as number from |
|
|
|
(SELECT 0 AS n 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 |
|
|
|
) t1 left join |
|
|
|
(select month(warning_time) hours,count(*) num from dc_warning t1 |
|
|
|
where DATE_FORMAT(t1.warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') and warning_source=6 |
|
|
|
GROUP BY hours) t2 |
|
|
|
on t1.n = t2.hours |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningFacilityDay" resultType="java.util.HashMap"> |
|
|
|
select facility_name as facilityName, COALESCE(w_count.number, 0) AS number |
|
|
|
from dc_facility AS s |
|
|
|
LEFT JOIN (SELECT w.stake_mark, COUNT(1) AS number FROM dc_warning AS w |
|
|
|
WHERE DATE_FORMAT(w.warning_time,'%Y-%m-%d') = DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
|
and w.warning_source=6 |
|
|
|
GROUP BY w.stake_mark ) AS w_count ON s.stake_mark = w_count.stake_mark |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningFacilityMonth" resultType="java.util.HashMap"> |
|
|
|
select facility_name as facilityName, COALESCE(w_count.number, 0) AS number |
|
|
|
from dc_facility AS s |
|
|
|
LEFT JOIN (SELECT w.stake_mark, COUNT(1) AS number FROM dc_warning AS w |
|
|
|
WHERE DATE_FORMAT(w.warning_time,'%Y-%m') = DATE_FORMAT(#{warningTime},'%Y-%m') |
|
|
|
and w.warning_source=6 |
|
|
|
GROUP BY w.stake_mark ) AS w_count ON s.stake_mark = w_count.stake_mark |
|
|
|
</select> |
|
|
|
<select id="selectNonAutomaticWarningFacilityYear" resultType="java.util.HashMap"> |
|
|
|
select facility_name as facilityName, COALESCE(w_count.number, 0) AS number |
|
|
|
from dc_facility AS s |
|
|
|
LEFT JOIN (SELECT w.stake_mark, COUNT(1) AS number FROM dc_warning AS w |
|
|
|
WHERE DATE_FORMAT(w.warning_time,'%Y') = DATE_FORMAT(#{warningTime},'%Y') |
|
|
|
and w.warning_source=6 |
|
|
|
GROUP BY w.stake_mark ) AS w_count ON s.stake_mark = w_count.stake_mark |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap">--> |
|
|
|
<!-- SELECT DISTINCT m.stake_mark stakeMarkId,--> |
|
|
|