Browse Source

感知统计相关接口

develop
zhao-meiyu 10 months ago
parent
commit
ac2348c92a
  1. 25
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

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

@ -83,14 +83,14 @@
GROUP BY time GROUP BY time
</select> </select>
<select id="selectWarningTrendMonth" resultType="java.util.HashMap"> <select id="selectWarningTrendMonth" resultType="java.util.HashMap">
SELECT DATE(warning.create_time) AS DAY, COUNT(*) AS number SELECT DATE(warning.create_time) AS day, COUNT(*) AS number
FROM dc_warning as warning FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark
WHERE DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m') WHERE DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')
AND warning.direction=#{direction} AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId} and mark.`section_id`=#{sectionId}
GROUP BY DAY GROUP BY day
ORDER BY DAY ORDER BY day
</select> </select>
<select id="selectWarningTrendQuarter" resultType="java.util.HashMap"> <select id="selectWarningTrendQuarter" resultType="java.util.HashMap">
SELECT SELECT
@ -100,7 +100,7 @@
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度' WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度'
ELSE '第四季度' ELSE '第四季度'
END AS QUARTER, END AS QUARTER,
MONTH(warning.create_time) AS MONTH, MONTH(warning.create_time) AS month,
COUNT(*) AS number COUNT(*) AS number
FROM dc_warning as warning FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark
@ -112,14 +112,17 @@
</select> </select>
<select id="selectWarningTrendYear" resultType="java.util.HashMap"> <select id="selectWarningTrendYear" resultType="java.util.HashMap">
SELECT YEAR(warning.create_time) AS YEAR, COUNT(*) AS number SELECT month(warning.create_time) AS month, COUNT(*) AS number
FROM dc_warning as warning FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction} where mark.`section_id`=#{sectionId} AND warning.direction=#{direction}
GROUP BY YEAR and DATE_FORMAT(warning.create_time,'%Y')=DATE_FORMAT(#{createTime},'%Y')
GROUP BY month
</select> </select>
<select id="selectWarningSectionTypeDay" resultType="java.util.HashMap"> <select id="selectWarningSectionTypeDay" resultType="java.util.HashMap">
SELECT warning.warning_type warningType,COUNT(*) AS number SELECT warning.warning_type warningType,
DATE_FORMAT(warning.create_time, '%Y-%m-%d %H') AS time,
COUNT(*) AS number
FROM dc_warning as warning FROM dc_warning as warning
LEFT JOIN dc_stake_mark as mark on warning.stake_mark_id=mark.stake_mark LEFT JOIN dc_stake_mark as mark on warning.stake_mark_id=mark.stake_mark
where DATE_FORMAT(warning.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')
@ -158,10 +161,12 @@
</select> </select>
<select id="selectWarningSectionTypeYear" resultType="java.util.HashMap"> <select id="selectWarningSectionTypeYear" resultType="java.util.HashMap">
SELECT warning.warning_type warningType, COUNT(*) AS number, SELECT warning.warning_type warningType, COUNT(*) AS number,
month(warning.create_time) AS month,
DATE_FORMAT(warning.create_time, '%Y') as createTime DATE_FORMAT(warning.create_time, '%Y') as createTime
FROM dc_warning as warning FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark_id=mark.stake_mark
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction} where mark.`section_id`=#{sectionId} AND warning.direction=#{direction}
and DATE_FORMAT(warning.create_time,'%Y')=DATE_FORMAT(#{createTime},'%Y')
GROUP BY warningType GROUP BY warningType
</select> </select>
@ -173,10 +178,10 @@
</select> </select>
<select id="selectWarningEscalation" resultType="java.util.HashMap"> <select id="selectWarningEscalation" resultType="java.util.HashMap">
select org.organization_name,warning.warning_type,warning.warning_subclass, select org.organization_name,warning.warning_type,warning.warning_subclass,
warning_title,warning.warning_state,warning. warning_title,warning.warning_state,
warning_source,DATE_FORMAT(warning.create_time,'%Y-%m-%d %H:%m:%s') createTime from dc_warning as warning warning. warning_source,DATE_FORMAT(warning.create_time,'%Y-%m-%d %H:%m:%s') createTime from dc_warning as warning
LEFT JOIN dc_stake_mark as mark on warning.stake_mark_id=mark.stake_mark LEFT JOIN dc_stake_mark as mark on warning.stake_mark_id=mark.stake_mark
LEFT JOIN dc_organization as org on mark.stake_mark=org.stake_mark_id AND mark.direction=org.direction LEFT JOIN dc_organization as org on mark.stake_mark=org.stake_mark_id
<where> <where>
<if test="warningState != null and warningState != ''"> and warning.warning_state = #{warningState}</if> <if test="warningState != null and warningState != ''"> and warning.warning_state = #{warningState}</if>
</where> </where>

Loading…
Cancel
Save