Browse Source

优化响应

develop
wangsixiang 3 months ago
parent
commit
ac65198b07
  1. 72
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

72
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -566,33 +566,53 @@
<!-- </select>--> <!-- </select>-->
<select id="newSelectSectionDay" resultType="java.util.HashMap"> <select id="newSelectSectionDay" resultType="java.util.HashMap">
SELECT SELECT
DATE_FORMAT(#{currently} + INTERVAL a.a HOUR, '%Y-%m-%d %H') AS time, DATE_FORMAT(DATE_ADD(#{currently}, INTERVAL a.hour HOUR), '%Y-%m-%d %H') AS time,
IFNULL(SUM(CASE WHEN dw.warning_source != 6 AND IFNULL(
CAST(SUBSTRING(SUBSTRING_INDEX(dw.stake_mark,'+',1),2)AS UNSIGNED)*1000 SUM(
+ CAST(SUBSTRING_INDEX(dw.stake_mark, '+', -1) AS UNSIGNED)&gt;#{startStakeMark} AND CASE
CAST(SUBSTRING(SUBSTRING_INDEX(dw.stake_mark,'+',1),2)AS UNSIGNED)*1000
+ CAST(SUBSTRING_INDEX(dw.stake_mark, '+', -1) AS UNSIGNED)&lt;#{endStakeMark} WHEN CAST( SUBSTRING( SUBSTRING_INDEX( dw.stake_mark, '+', 1 ), 2 ) AS UNSIGNED )* 1000
THEN 1 ELSE 0 END), 0) AS number + CAST( SUBSTRING_INDEX( dw.stake_mark, '+', - 1 ) AS UNSIGNED )> #{startStakeMark}
FROM ( AND CAST( SUBSTRING( SUBSTRING_INDEX( dw.stake_mark, '+', 1 ), 2 ) AS UNSIGNED )* 1000
SELECT 0 AS a + CAST( SUBSTRING_INDEX( dw.stake_mark, '+', - 1 ) AS UNSIGNED ) &lt; #{endStakeMark} THEN
UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 1 ELSE 0
UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 END
UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 ),
UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 0
UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL SELECT 15 ) AS number
UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 FROM
UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 (SELECT 0 AS hour UNION ALL SELECT 1 UNION ALL
UNION ALL SELECT 22 UNION ALL SELECT 23 SELECT 2 UNION ALL SELECT 3 UNION ALL
) AS a SELECT 4 UNION ALL SELECT 5 UNION ALL
LEFT JOIN dc_warning dw ON dw.warning_time >= DATE_ADD(#{currently}, INTERVAL a.a HOUR) SELECT 6 UNION ALL SELECT 7 UNION ALL
AND dw.warning_time &lt; DATE_ADD(#{currently}, INTERVAL a.a + 1 HOUR) SELECT 8 UNION ALL SELECT 9 UNION ALL
and dw.warning_source!=6 SELECT 10 UNION ALL SELECT 11 UNION ALL
and dw.direction=#{direction} SELECT 12 UNION ALL SELECT 13 UNION ALL
where dw.warning_time >= #{currently} SELECT 14 UNION ALL SELECT 15 UNION ALL
AND dw.warning_time &lt; DATE_ADD( #{currently}, INTERVAL 1 DAY) SELECT 16 UNION ALL SELECT 17 UNION ALL
GROUP BY time SELECT 18 UNION ALL SELECT 19 UNION ALL
ORDER BY time; SELECT 20 UNION ALL SELECT 21 UNION ALL SELECT 22 UNION ALL SELECT 23) AS a
LEFT JOIN (
SELECT
warning_time,stake_mark,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(stake_mark, '+', 1), ':', -1) AS UNSIGNED) * 1000
+ CAST(SUBSTRING_INDEX(stake_mark, '+', -1) AS UNSIGNED) AS stake_mark_value
FROM
dc_warning
WHERE
warning_source != 6
AND direction = #{direction}
AND warning_time >= #{currently}
AND warning_time &lt; DATE_ADD(#{currently}, INTERVAL 1 DAY)
) dw ON dw.warning_time >= DATE_ADD(#{currently}, INTERVAL a.hour HOUR)
AND dw.warning_time &lt; DATE_ADD(#{currently}, INTERVAL a.hour + 1 HOUR)
GROUP BY
time
ORDER BY
time;
</select> </select>
<select id="newSelectSectionMonth" resultType="java.util.HashMap"> <select id="newSelectSectionMonth" resultType="java.util.HashMap">
SELECT SELECT

Loading…
Cancel
Save