|
|
@ -101,6 +101,7 @@ |
|
|
|
LEFT JOIN ( SELECT mark.section_id, COUNT(1) AS number FROM dc_warning AS w JOIN |
|
|
|
dc_stake_mark AS mark ON mark.stake_mark = w.stake_mark AND mark.direction = w.direction |
|
|
|
WHERE mark.stake_mark IS NOT NULL AND DATE_FORMAT(w.warning_time, '%Y-%m-%d') = DATE_FORMAT(#{warningTime}, '%Y-%m-%d') |
|
|
|
and w.warning_source!=6 |
|
|
|
GROUP BY mark.section_id ) AS w_count ON s.id = w_count.section_id |
|
|
|
</select> |
|
|
|
<select id="selectDailyCumulative" resultType="java.util.HashMap"> |
|
|
@ -119,7 +120,7 @@ |
|
|
|
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') |
|
|
|
= DATE_FORMAT(CURDATE() + INTERVAL a.a HOUR, '%Y-%m-%d %H') and dw.warning_source!=6 |
|
|
|
GROUP BY time |
|
|
|
ORDER BY time; |
|
|
|
</select> |
|
|
@ -127,18 +128,18 @@ |
|
|
|
SELECT HOUR(warning_time) AS time, COUNT(*) AS number |
|
|
|
FROM dc_warning |
|
|
|
WHERE MONTH(warning_time) = MONTH(CURDATE()) |
|
|
|
AND YEAR(warning_time) = YEAR(CURDATE()) |
|
|
|
AND YEAR(warning_time) = YEAR(CURDATE()) and warning_source!=6 |
|
|
|
GROUP BY HOUR(warning_time) |
|
|
|
ORDER BY HOUR(warning_time); |
|
|
|
</select> |
|
|
|
<select id="selectWarningSourceGroup" resultType="java.util.HashMap"> |
|
|
|
SELECT warning_source warningSource,COUNT(*) AS number FROM dc_warning |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') and warning_source!=6 |
|
|
|
GROUP BY warning_source |
|
|
|
</select> |
|
|
|
<select id="selectWarningSourceGroupCount" resultType="java.lang.String"> |
|
|
|
SELECT COUNT(*) AS number FROM dc_warning |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') and warning_source!=6 |
|
|
|
</select> |
|
|
|
<select id="selectWarningStateDay" resultType="java.util.HashMap"> |
|
|
|
select t1.warningState,t1.warningStateName,IFNULL(t2.num,0)number from |
|
|
@ -149,12 +150,13 @@ |
|
|
|
LEFT JOIN |
|
|
|
(SELECT warning_state warningState,count(*) num |
|
|
|
from dc_warning |
|
|
|
where DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d') |
|
|
|
where warning_source!=6 and DATE_FORMAT(warning_time,'%Y-%m-%d')=DATE_FORMAT(now(),'%Y-%m-%d') |
|
|
|
GROUP BY warning_state)t2 |
|
|
|
on t1.warningState=t2.warningState |
|
|
|
</select> |
|
|
|
<select id="selectWarningTypeDay" resultType="java.util.HashMap"> |
|
|
|
SELECT warning_type warningType,COUNT(*) AS number FROM dc_warning |
|
|
|
where warning_source!=6 |
|
|
|
GROUP BY warning_type |
|
|
|
ORDER BY number DESC |
|
|
|
</select> |
|
|
@ -169,7 +171,7 @@ |
|
|
|
) 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 |
|
|
|
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.warning_source!=6 |
|
|
|
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} |
|
|
@ -182,7 +184,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
|
WHERE DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m') |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
GROUP BY day |
|
|
|
ORDER BY day |
|
|
|
</select> |
|
|
@ -194,7 +196,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
|
WHERE QUARTER(warning.warning_time)=#{quarter} |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
GROUP BY MONTH |
|
|
|
ORDER BY MONTH; |
|
|
|
|
|
|
@ -209,7 +211,7 @@ |
|
|
|
(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 |
|
|
|
and t1.direction=#{direction} and t1.warning_source!=6 and t2.direction=#{direction} GROUP BY hours) t2 |
|
|
|
on t1.n = t2.hours |
|
|
|
</select> |
|
|
|
<select id="selectWarningSectionTypeDayCount" resultType="java.lang.String"> |
|
|
@ -217,7 +219,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark |
|
|
|
where DATE_FORMAT(warning.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
</select> |
|
|
|
<select id="selectWarningSectionTypeDay" resultType="java.util.HashMap"> |
|
|
|
SELECT warning.warning_type warningType, |
|
|
@ -226,7 +228,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark |
|
|
|
where DATE_FORMAT(warning.warning_time,'%Y-%m-%d')=DATE_FORMAT(#{warningTime},'%Y-%m-%d') |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
GROUP BY warning_type |
|
|
|
ORDER BY number DESC |
|
|
|
</select> |
|
|
@ -235,7 +237,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark |
|
|
|
where DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m') |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
</select> |
|
|
|
<select id="selectWarningSectionTypeMonth" resultType="java.util.HashMap"> |
|
|
|
SELECT warning.warning_type warningType,COUNT(*) AS number |
|
|
@ -243,7 +245,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark |
|
|
|
where DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m') |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
GROUP BY warning_type |
|
|
|
ORDER BY number DESC |
|
|
|
</select> |
|
|
@ -254,7 +256,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
|
WHERE QUARTER(warning.warning_time)=#{quarter} |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
</select> |
|
|
|
<select id="selectWarningSectionTypeQuarter" resultType="java.util.HashMap"> |
|
|
|
SELECT |
|
|
@ -264,7 +266,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
|
WHERE QUARTER(warning.warning_time)=#{quarter} |
|
|
|
AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and mark.`section_id`=#{sectionId} |
|
|
|
and mark.`section_id`=#{sectionId} and warning.warning_source!=6 |
|
|
|
GROUP BY warningType |
|
|
|
|
|
|
|
</select> |
|
|
@ -273,7 +275,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
|
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and DATE_FORMAT(warning.warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') |
|
|
|
|
|
|
|
and warning.warning_source!=6 |
|
|
|
</select> |
|
|
|
<select id="selectWarningSectionTypeYear" resultType="java.util.HashMap"> |
|
|
|
SELECT warning.warning_type warningType, COUNT(*) AS number |
|
|
@ -281,6 +283,7 @@ |
|
|
|
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark |
|
|
|
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction} and mark.direction=#{direction} |
|
|
|
and DATE_FORMAT(warning.warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') |
|
|
|
and warning.warning_source!=6 |
|
|
|
GROUP BY warningType |
|
|
|
</select> |
|
|
|
|
|
|
@ -356,7 +359,7 @@ |
|
|
|
<select id="selectWarningMarkQuarterOptimize" resultType="java.util.HashMap"> |
|
|
|
SELECT DISTINCT m.stake_mark AS stakeMarkId,COALESCE(wc.count, 0) AS sectionNumber |
|
|
|
FROM dc_stake_mark AS m LEFT JOIN ( SELECT stake_mark, COUNT(0) AS count FROM dc_warning WHERE |
|
|
|
QUARTER(warning_time) =#{quarter} AND direction = #{direction} GROUP BY stake_mark ) AS wc |
|
|
|
QUARTER(warning_time) =#{quarter} 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="selectWarningMarkDayOptimize" resultType="java.util.HashMap"> |
|
|
@ -366,7 +369,7 @@ |
|
|
|
<if test = 'type == "day"' > DATE(warning_time)= DATE_FORMAT(#{warningTime},'%Y-%m-%d')</if> |
|
|
|
<if test = 'type == "month"' > DATE_FORMAT(warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m')</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} and warning_source!=6 GROUP BY stake_mark ) AS wc ON m.stake_mark = wc.stake_mark |
|
|
|
WHERE m.section_id = #{sectionId} |
|
|
|
</select> |
|
|
|
|
|
|
|