You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
290 lines
15 KiB
290 lines
15 KiB
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.zc.business.mapper.DcPerceivedEventsWarningMapper">
|
|
|
|
|
|
|
|
<select id="perceivedEventsWarningNum" resultType="java.lang.Integer">
|
|
select count(1) from dc_warning
|
|
</select>
|
|
|
|
<select id="selectEventTypeList" resultType="com.zc.business.domain.DcEventType">
|
|
select event_type, event_name from dc_event_type
|
|
</select>
|
|
<select id="selectWarningById" resultType="com.zc.business.domain.DcWarning">
|
|
SELECT DISTINCT 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
|
|
where warning.`id`=#{id}
|
|
</select>
|
|
<select id="selectPerceivedEventsList" resultType="com.zc.business.domain.DcWarning">
|
|
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
|
|
<where>
|
|
<if test="warningType != null and warningType != ''"> and warning_type = #{warningType}</if>
|
|
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if>
|
|
</where>
|
|
</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=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
|
|
order by number desc
|
|
</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=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
|
|
</select>
|
|
<select id="selectDailyCumulative" resultType="java.util.HashMap">
|
|
SELECT DATE_FORMAT(create_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number
|
|
FROM dc_warning
|
|
WHERE create_time >= CURDATE() AND create_time <![CDATA[<]]> CURDATE() + INTERVAL 1 DAY
|
|
GROUP BY time
|
|
ORDER BY time
|
|
</select>
|
|
<select id="selectDailyCumulativeMonth" resultType="java.util.HashMap">
|
|
SELECT HOUR(create_time) AS time, COUNT(*) AS number
|
|
FROM dc_warning
|
|
WHERE MONTH(create_time) = MONTH(CURDATE())
|
|
AND YEAR(create_time) = YEAR(CURDATE())
|
|
GROUP BY HOUR(create_time)
|
|
ORDER BY HOUR(create_time);
|
|
</select>
|
|
<select id="selectWarningSourceGroup" resultType="java.util.HashMap">
|
|
SELECT warning_source warningSource,COUNT(*) AS number FROM dc_warning
|
|
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
|
|
GROUP BY warning_source
|
|
</select>
|
|
<select id="selectWarningSourceGroupCount" resultType="java.lang.String">
|
|
SELECT COUNT(*) AS number FROM dc_warning
|
|
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
|
|
</select>
|
|
<select id="selectWarningStateDay" resultType="java.util.HashMap">
|
|
SELECT warning_state warningState,COUNT(*) AS number FROM dc_warning
|
|
where DATE_FORMAT(create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
|
|
GROUP BY warning_state
|
|
</select>
|
|
<select id="selectWarningTypeDay" resultType="java.util.HashMap">
|
|
SELECT warning_type warningType,COUNT(*) AS number FROM dc_warning
|
|
GROUP BY warning_type
|
|
ORDER BY number DESC
|
|
</select>
|
|
<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=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}
|
|
GROUP BY time
|
|
</select>
|
|
<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=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}
|
|
GROUP BY day
|
|
ORDER BY day
|
|
</select>
|
|
<select id="selectWarningTrendQuarter" resultType="java.util.HashMap">
|
|
SELECT
|
|
CASE
|
|
WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度'
|
|
WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度'
|
|
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度'
|
|
ELSE '第四季度'
|
|
END AS QUARTER,
|
|
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=mark.stake_mark
|
|
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y')
|
|
AND warning.direction=#{direction}
|
|
and mark.`section_id`=#{sectionId}
|
|
GROUP BY QUARTER, MONTH
|
|
ORDER BY QUARTER, MONTH;
|
|
|
|
</select>
|
|
<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=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="selectWarningSectionTypeDayCount" resultType="java.lang.String">
|
|
SELECT COUNT(*) AS number FROM dc_warning as warning
|
|
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}
|
|
</select>
|
|
<select id="selectWarningSectionTypeDay" 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=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}
|
|
GROUP BY warning_type
|
|
ORDER BY number DESC
|
|
</select>
|
|
<select id="selectWarningSectionTypeMonthCount" resultType="java.lang.String">
|
|
SELECT COUNT(*) AS number FROM dc_warning as warning
|
|
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}
|
|
</select>
|
|
<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=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}
|
|
GROUP BY warning_type
|
|
ORDER BY number DESC
|
|
</select>
|
|
<select id="selectWarningSectionTypeQuarterCount" resultType="hashmap">
|
|
SELECT
|
|
CASE
|
|
WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度'
|
|
WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度'
|
|
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度'
|
|
ELSE '第四季度'
|
|
END AS QUARTER,COUNT(*) AS number
|
|
FROM dc_warning as warning
|
|
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}
|
|
GROUP BY QUARTER
|
|
</select>
|
|
<select id="selectWarningSectionTypeQuarter" resultType="java.util.HashMap">
|
|
SELECT
|
|
CASE
|
|
WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度'
|
|
WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度'
|
|
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度'
|
|
ELSE '第四季度'
|
|
END AS QUARTER,
|
|
warning.warning_type warningType,
|
|
COUNT(*) AS number
|
|
FROM dc_warning as warning
|
|
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}
|
|
GROUP BY QUARTER, warningType
|
|
ORDER BY QUARTER;
|
|
</select>
|
|
<select id="selectWarningSectionTypeYearCount" resultType="java.lang.String">
|
|
SELECT COUNT(*) AS number FROM dc_warning as warning
|
|
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')
|
|
|
|
</select>
|
|
<select id="selectWarningSectionTypeYear" 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=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
|
|
</select>
|
|
|
|
<select id="selectSectionMark" resultType="java.util.HashMap">
|
|
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=#{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=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>
|
|
</select>
|
|
|
|
<update id="updateWarning">
|
|
update dc_warning
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<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>
|
|
<if test="warningTime != null">warning_time = #{warningTime},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="warningSource != null">warning_source = #{warningSource},</if>
|
|
<if test="warningLevel != null">warning_level = #{warningLevel},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="warningType != null">warning_type = #{warningType},</if>
|
|
<if test="warningSubclass != null">warning_subclass = #{warningSubclass},</if>
|
|
<if test="warningTitle != null">warning_title = #{warningTitle},</if>
|
|
<if test="otherConfig != null">other_config = #{otherConfig},</if>
|
|
<if test="lane != null">lane = #{lane},</if>
|
|
<if test="vehicleType != null">vehicle_type = #{vehicleType},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<select id="selectWarningMarkDay" resultType="java.lang.String">
|
|
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=#{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=#{stakeMark}
|
|
AND direction=#{direction} and YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y')
|
|
</select>
|
|
<select id="selectWarningMarkQuarter" resultType="hashmap">
|
|
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=#{stakeMark} and
|
|
YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y')
|
|
AND direction=#{direction}
|
|
GROUP BY QUARTER
|
|
ORDER BY QUARTER;
|
|
</select>
|
|
<select id="selectNumber" resultType="int">
|
|
select count(1) from dc_warning
|
|
</select>
|
|
|
|
|
|
</mapper>
|