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 id="newSelectSectionDay" resultType="java.util.HashMap">
SELECT
DATE_FORMAT(#{currently} + INTERVAL a.a HOUR, '%Y-%m-%d %H') AS time,
IFNULL(SUM(CASE WHEN dw.warning_source != 6 AND
CAST(SUBSTRING(SUBSTRING_INDEX(dw.stake_mark,'+',1),2)AS UNSIGNED)*1000
+ CAST(SUBSTRING_INDEX(dw.stake_mark, '+', -1) AS UNSIGNED)&gt;#{startStakeMark} AND
CAST(SUBSTRING(SUBSTRING_INDEX(dw.stake_mark,'+',1),2)AS UNSIGNED)*1000
+ CAST(SUBSTRING_INDEX(dw.stake_mark, '+', -1) AS UNSIGNED)&lt;#{endStakeMark}
THEN 1 ELSE 0 END), 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 dw.warning_time >= DATE_ADD(#{currently}, INTERVAL a.a HOUR)
AND dw.warning_time &lt; DATE_ADD(#{currently}, INTERVAL a.a + 1 HOUR)
and dw.warning_source!=6
and dw.direction=#{direction}
where dw.warning_time >= #{currently}
AND dw.warning_time &lt; DATE_ADD( #{currently}, INTERVAL 1 DAY)
GROUP BY time
ORDER BY time;
DATE_FORMAT(DATE_ADD(#{currently}, INTERVAL a.hour HOUR), '%Y-%m-%d %H') AS time,
IFNULL(
SUM(
CASE
WHEN CAST( SUBSTRING( SUBSTRING_INDEX( dw.stake_mark, '+', 1 ), 2 ) AS UNSIGNED )* 1000
+ CAST( SUBSTRING_INDEX( dw.stake_mark, '+', - 1 ) AS UNSIGNED )> #{startStakeMark}
AND CAST( SUBSTRING( SUBSTRING_INDEX( dw.stake_mark, '+', 1 ), 2 ) AS UNSIGNED )* 1000
+ CAST( SUBSTRING_INDEX( dw.stake_mark, '+', - 1 ) AS UNSIGNED ) &lt; #{endStakeMark} THEN
1 ELSE 0
END
),
0
) AS number
FROM
(SELECT 0 AS hour 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 (
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 id="newSelectSectionMonth" resultType="java.util.HashMap">
SELECT

Loading…
Cancel
Save