Browse Source

感知统计相关接口

develop
zhao-meiyu 1 year ago
parent
commit
7f2c180933
  1. 47
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

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

@ -15,14 +15,14 @@
</select>
<select id="selectPerceivedEventsList" resultType="com.zc.business.domain.DcWarning">
SELECT warning.`id`,warning.`stake_mark_id`, warning.`direction`,
SELECT warning.`id`,warning.`stake_mark`, warning.`direction`,
mark.longitude,mark.latitude,warning.lane,
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_id
LEFT JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark
<where>
<if test="warningType != null and warningType != ''"> and warning_type = #{warningType}</if>
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if>
@ -30,7 +30,7 @@
</select>
<select id="selectSectionPerceivedEventsList" resultType="hashmap">
SELECT COUNT(1) as number,section.section_name sectionName 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=mark.stake_mark
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
group by section.section_name
@ -38,7 +38,7 @@
</select>
<select id="selectSectionPerceivedNumber" resultType="java.util.HashMap">
SELECT COUNT(1) as number,section.section_name sectionName 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=mark.stake_mark
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
group by section.section_name
@ -76,7 +76,7 @@
<select id="selectWarningTrendDay" resultType="java.util.HashMap">
SELECT DATE_FORMAT(warning.create_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number
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=mark.stake_mark
WHERE DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
AND warning.direction=#{direction}
AND mark.`section_id`=#{sectionId}
@ -85,7 +85,7 @@
<select id="selectWarningTrendMonth" resultType="java.util.HashMap">
SELECT DATE(warning.create_time) AS day, COUNT(*) AS number
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=mark.stake_mark
WHERE DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')
AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId}
@ -103,7 +103,7 @@
MONTH(warning.create_time) AS month,
COUNT(*) AS number
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=mark.stake_mark
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y')
AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId}
@ -114,17 +114,16 @@
<select id="selectWarningTrendYear" resultType="java.util.HashMap">
SELECT month(warning.create_time) AS month, COUNT(*) AS number
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=mark.stake_mark
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction}
and DATE_FORMAT(warning.create_time,'%Y')=DATE_FORMAT(#{createTime},'%Y')
GROUP BY month
</select>
<select id="selectWarningSectionTypeDay" resultType="java.util.HashMap">
SELECT warning.warning_type warningType,
DATE_FORMAT(warning.create_time, '%Y-%m-%d %H') AS time,
COUNT(*) AS number
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=mark.stake_mark
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId}
@ -134,7 +133,7 @@
<select id="selectWarningSectionTypeMonth" resultType="java.util.HashMap">
SELECT warning.warning_type warningType,COUNT(*) AS number
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=mark.stake_mark
where DATE_FORMAT(warning.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')
AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId}
@ -152,7 +151,7 @@
warning.warning_type warningType,
COUNT(*) AS number
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=mark.stake_mark
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y')
AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId}
@ -160,11 +159,9 @@
ORDER BY QUARTER;
</select>
<select id="selectWarningSectionTypeYear" resultType="java.util.HashMap">
SELECT warning.warning_type warningType, COUNT(*) AS number,
month(warning.create_time) AS month,
DATE_FORMAT(warning.create_time, '%Y') as createTime
SELECT warning.warning_type warningType, COUNT(*) AS number
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=mark.stake_mark
where mark.`section_id`=#{sectionId} AND warning.direction=#{direction}
and DATE_FORMAT(warning.create_time,'%Y')=DATE_FORMAT(#{createTime},'%Y')
GROUP BY warningType
@ -174,14 +171,14 @@
SELECT stake_mark stakeMark FROM dc_stake_mark AS mark WHERE mark.section_id=#{sectionId}
</select>
<select id="selectSectionNumber" resultType="java.lang.String">
select count(1) from dc_warning where stake_mark_id=#{stakeMarkId} AND warning.direction=#{direction}
select count(1) from dc_warning where stake_mark=#{stakeMark} AND warning.direction=#{direction}
</select>
<select id="selectWarningEscalation" resultType="java.util.HashMap">
select org.organization_name,warning.warning_type,warning.warning_subclass,
warning_title,warning.warning_state,
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_organization as org on mark.stake_mark=org.stake_mark_id
LEFT JOIN dc_stake_mark as mark on warning.stake_mark=mark.stake_mark
LEFT JOIN dc_organization as org on mark.stake_mark=org.stake_mark
<where>
<if test="warningState != null and warningState != ''"> and warning.warning_state = #{warningState}</if>
</where>
@ -190,7 +187,7 @@
<update id="updateWarning">
update dc_warning
<trim prefix="SET" suffixOverrides=",">
<if test="stakeMarkId != null and stakeMarkId != ''">stake_mark_id = #{stakeMarkId},</if>
<if test="stakeMark != null and stakeMark != ''">stake_mark = #{stakeMark},</if>
<if test="direction != null">direction = #{direction},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="warningState != null">warning_state = #{warningState},</if>
@ -209,26 +206,26 @@
where id = #{id}
</update>
<select id="selectWarningMarkDay" resultType="java.lang.String">
select count(1) from dc_warning where stake_mark_id=#{stakeMark}
select count(1) from dc_warning where stake_mark=#{stakeMark}
AND direction=#{direction} and DATE(create_time)=DATE_FORMAT(#{createTime},'%Y-%m-%d')
</select>
<select id="selectWarningMarkMonth" resultType="java.lang.String">
select count(1) from dc_warning where stake_mark_id=#{stakeMark}
select count(1) from dc_warning where stake_mark=#{stakeMark}
AND direction=#{direction} and DATE_FORMAT(create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')
</select>
<select id="selectWarningMarkYear" resultType="java.lang.String">
select count(1) from dc_warning where stake_mark_id=#{stakeMark}
select count(1) from dc_warning where stake_mark=#{stakeMark}
AND direction=#{direction} and YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y')
</select>
<select id="selectWarningMarkQuarter" resultType="hashmap">
select count(1) number,stake_mark_id stakeMarkId,
select count(1) number,stake_mark stakeMark,
CASE
WHEN MONTH(create_time) BETWEEN 1 AND 3 THEN '第一季度'
WHEN MONTH(create_time) BETWEEN 4 AND 6 THEN '第二季度'
WHEN MONTH(create_time) BETWEEN 7 AND 9 THEN '第三季度'
ELSE '第四季度'
END AS QUARTER
from dc_warning where stake_mark_id=#{stakeMark} and
from dc_warning where stake_mark=#{stakeMark} and
YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y')
AND direction=#{direction}
GROUP BY QUARTER

Loading…
Cancel
Save