济菏高速数据中心代码
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.
 
 
 
 
 

370 lines
19 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.DcPublishManageMapper">
<resultMap type="DcPublishManage" id="DcPublishManageResult">
<result property="id" column="id" />
<result property="eventId" column="event_id" />
<result property="deptId" column="dept_id" />
<result property="publishChannelsId" column="publish_channels_id" />
<result property="title" column="title" />
<result property="publishChannels" column="publish_channels" />
<result property="isverify" column="isverify" />
<result property="publisher" column="publisher" />
<result property="auditor1" column="auditor_1" />
<result property="auditor2" column="auditor_2" />
<result property="auditTime1" column="audit_time_1" />
<result property="auditTime2" column="audit_time_2" />
<result property="auditComment1" column="audit_comment_1" />
<result property="auditComment2" column="audit_comment_2" />
<result property="publishTime" column="publish_time" />
<result property="publishStatus" column="publish_status" />
<result property="contentDetails" column="content_details" />
<result property="remark" column="remark" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<result property="direction" column="direction" />
<result property="stakeMark" column="stake_mark" />
<result property="eventType" column="event_type" />
<result property="eventSubclass" column="event_subclass" />
<result property="eventTime" column="eventTime" />
<result property="facilityName" column="facility_name" />
<result property="eventState" column="event_state" />
<result property="logId" column="log_id" />
</resultMap>
<sql id="selectDcPublishManageVo">
select
manage.id, manage.event_id, manage.publish_channels_id,
manage.title , manage.create_time,
manage.publish_status,event.create_time eventTime,event.direction,event.stake_mark,
event.event_type,event.event_subclass,event.event_state
from dc_publish_manage as manage
LEFT JOIN dc_event as event on event.id=manage.event_id
LEFT JOIN dc_event_traffic_control as traffic on event.id=traffic.id
</sql>
<select id="selectEventDcPublishManageList" resultType="com.zc.business.domain.DcPublishManage">
select facility.facility_name,event.event_state,manage.publish_time, manage.create_time,
manage.id, manage.event_id, manage.publish_channels_id,
manage.title, manage.publish_channels , manage.publisher,
manage.publish_status, manage.content_details, manage.remark,
event.create_time eventTime
from dc_publish_manage as manage
LEFT JOIN dc_event as event on event.id=manage.event_id
LEFT JOIN dc_event_traffic_control as traffic on event.id=traffic.id
LEFT JOIN dc_facility as facility ON traffic.facility_id=facility.id
where manage.event_id=#{eventId}
</select>
<select id="selectDcPublishManageList" parameterType="DcPublishManage" resultMap="DcPublishManageResult">
<include refid="selectDcPublishManageVo"/>
<where>
manage.event_id is not null
<if test="eventState != null"> and event.event_state = #{eventState}</if>
<if test="eventType != null and eventType != ''"> and event.event_type = #{eventType}</if>
<if test="publishStatus != null "> and manage.publish_status = #{publishStatus}</if>
<if test="startTime != null and endTime != null ">
and manage.create_time between #{startTime} and #{endTime}
</if>
<if test="startStakeMark != null and startStakeMark != ''">
and CAST(SUBSTRING(SUBSTRING_INDEX(event.stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(event.stake_mark, '+', -1) AS UNSIGNED)&gt;=#{startStakeMark}
</if>
<if test=" endStakeMark != null and endStakeMark != '' ">
and CAST(SUBSTRING(SUBSTRING_INDEX(event.stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(event.stake_mark, '+', -1) AS UNSIGNED)&lt;=#{endStakeMark}
</if>
</where>
GROUP BY manage.event_id
ORDER BY event.create_time desc
</select>
<select id="selectDcPublishManageById" parameterType="Long" resultMap="DcPublishManageResult">
<include refid="selectDcPublishManageVo"/>
where id = #{id}
</select>
<select id="selectEventType" resultType="java.lang.Integer">
select event_type from dc_event where id=#{eventId}
</select>
<select id="selectPublishManage" resultType="com.zc.business.domain.DcPublishManage">
select id,publish_channels from dc_publishing_channels where enabled=2 and data_category=#{dataCategory}
</select>
<select id="selectDcPublishManageListMap" resultType="java.util.HashMap">
select
event.occurrence_time,event.direction,event.event_type,event.stake_mark,
manage.id, manage.event_id, manage.publish_channels_id,
manage.title, manage.publish_channels, manage.publisher,
manage.publish_time, manage.publish_status, manage.content_details, manage.remark,
manage.update_time, manage.create_time from dc_publish_manage as manage
LEFT JOIN dc_event as event on manage.event_id=event.id
</select>
<insert id="insertDcPublishManage" parameterType="DcPublishManage" useGeneratedKeys="true" keyProperty="id">
insert into dc_publish_manage
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="eventId != null and eventId != ''">event_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="publishChannelsId != null">publish_channels_id,</if>
<if test="title != null">title,</if>
<if test="publishChannels != null">publish_channels,</if>
<if test="isverify != null">isverify,</if>
<if test="publisher != null and publisher != ''">publisher,</if>
<if test="auditor1 != null">auditor_1,</if>
<if test="auditor2 != null">auditor_2,</if>
<if test="auditTime1 != null">audit_time_1,</if>
<if test="auditTime2 != null">audit_time_2,</if>
<if test="auditComment1 != null">audit_comment_1,</if>
<if test="auditComment2 != null">audit_comment_2,</if>
<if test="publishTime != null">publish_time,</if>
<if test="publishStatus != null">publish_status,</if>
<if test="contentDetails != null">content_details,</if>
<if test="remark != null">remark,</if>
<if test="updateTime != null">update_time,</if>
<if test="createTime != null">create_time,</if>
<if test="logId != null">log_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="eventId != null and eventId != ''">#{eventId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="publishChannelsId != null">#{publishChannelsId},</if>
<if test="title != null">#{title},</if>
<if test="publishChannels != null">#{publishChannels},</if>
<if test="isverify != null">#{isverify},</if>
<if test="publisher != null and publisher != ''">#{publisher},</if>
<if test="auditor1 != null">#{auditor1},</if>
<if test="auditor2 != null">#{auditor2},</if>
<if test="auditTime1 != null">#{auditTime1},</if>
<if test="auditTime2 != null">#{auditTime2},</if>
<if test="auditComment1 != null">#{auditComment1},</if>
<if test="auditComment2 != null">#{auditComment2},</if>
<if test="publishTime != null">#{publishTime},</if>
<if test="publishStatus != null">#{publishStatus},</if>
<if test="contentDetails != null">#{contentDetails},</if>
<if test="remark != null">#{remark},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="logId != null">#{logId},</if>
</trim>
</insert>
<update id="updateDcPublishManage" parameterType="DcPublishManage">
update dc_publish_manage
<trim prefix="SET" suffixOverrides=",">
<if test="eventId != null and eventId != ''">event_id = #{eventId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="publishChannelsId != null">publish_channels_id = #{publishChannelsId},</if>
<if test="title != null">title = #{title},</if>
<if test="publishChannels != null">publish_channels = #{publishChannels},</if>
<if test="isverify != null">isverify = #{isverify},</if>
<if test="publisher != null and publisher != ''">publisher = #{publisher},</if>
<if test="auditor1 != null">auditor_1 = #{auditor1},</if>
<if test="auditor2 != null">auditor_2 = #{auditor2},</if>
<if test="auditTime1 != null">audit_time_1 = #{auditTime1},</if>
<if test="auditTime2 != null">audit_time_2 = #{auditTime2},</if>
<if test="auditComment1 != null">audit_comment_1 = #{auditComment1},</if>
<if test="auditComment2 != null">audit_comment_2 = #{auditComment2},</if>
<if test="publishTime != null">publish_time = #{publishTime},</if>
<if test="publishStatus != null">publish_status = #{publishStatus},</if>
<if test="contentDetails != null">content_details = #{contentDetails},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="logId != null">log_id = #{logId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcPublishManageById" parameterType="Long">
delete from dc_publish_manage where id = #{id}
</delete>
<delete id="deleteDcPublishManageEventId">
delete from dc_publish_manage where event_id = #{eventId}
</delete>
<delete id="deleteDcPublishManageByIds" parameterType="String">
delete from dc_publish_manage where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteDisPathSource">
DELETE FROM dc_dispatch_resource WHERE dispatch_id IN (
SELECT id FROM dc_dispatch WHERE event_id = #{eventId}
)
</delete>
<delete id="deleteDisPath">
DELETE FROM dc_dispatch WHERE event_id = #{eventId}
</delete>
<select id="statisticsPublishManage" resultType="java.util.HashMap">
SELECT
p.publish_channels publishChannels,
COALESCE(SUM(CASE WHEN m.publish_channels = p.publish_channels THEN 1 ELSE 0 END), 0) AS number
FROM (
SELECT 1 AS publish_channels UNION ALL
SELECT 2 AS publish_channels UNION ALL
SELECT 3 AS publish_channels UNION ALL
SELECT 4 AS publish_channels UNION ALL
SELECT 5 AS publish_channels UNION ALL
SELECT 6 UNION ALL
SELECT 7
) AS p
LEFT JOIN dc_publish_manage AS m ON p.publish_channels = m.publish_channels
AND DATE(m.publish_time) = CURDATE()
GROUP BY p.publish_channels
ORDER BY p.publish_channels;
</select>
<select id="eventTypePublishManage" resultType="java.util.HashMap">
SELECT h.eventType,
COALESCE(m.number, 0) AS number
FROM (
SELECT 1 AS eventType
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
) AS h
LEFT JOIN (
SELECT publish_channels ,dc_event.event_type eventType, COUNT(*)AS number
FROM dc_publish_manage
LEFT JOIN dc_event on dc_publish_manage.event_id=dc_event.id
where event_id is not NULL AND DATE(publish_time) = CURDATE()
GROUP BY eventType
) AS m ON h.eventType = m.eventType
ORDER BY h.eventType
</select>
<select id="releaseTrendsPublishManage" resultType="java.util.HashMap">
SELECT h.hour,
pc.publish_channels publishChannels,
COALESCE(m.number, 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 h
CROSS JOIN (
SELECT 1 AS publish_channels
UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7
) AS pc
LEFT JOIN (
SELECT HOUR(publish_time) AS hour, publish_channels, COUNT(*)AS number
FROM dc_publish_manage
WHERE DATE(publish_time) = CURDATE()
GROUP BY HOUR(publish_time), publish_channels
) AS m ON h.hour = m.hour AND pc.publish_channels = m.publish_channels
ORDER BY h.hour, pc.publish_channels;
</select>
<select id="monthTrendsPublishManage" resultType="java.util.HashMap">
SELECT h.hour, pc.publish_channels publishChannels, COALESCE(m.number, 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 h
CROSS JOIN (
SELECT 1 AS publish_channels UNION ALL
SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7
) AS pc
LEFT JOIN (
SELECT HOUR(publish_time) AS hour, publish_channels, COUNT(*) AS number
FROM dc_publish_manage
WHERE YEAR(publish_time) = YEAR(CURDATE())
AND MONTH(publish_time) = MONTH(#{publishTime})
GROUP BY HOUR(publish_time), publish_channels
) AS m ON h.hour = m.hour AND pc.publish_channels = m.publish_channels
ORDER BY h.hour, pc.publish_channels;
</select>
<select id="eventTypePublishManageSum" resultType="java.util.HashMap">
SELECT h.eventType,
pc.publish_channels publishChannels,
COALESCE(m.number, 0) AS number
FROM (
SELECT 1 AS eventType
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
) AS h
CROSS JOIN (
SELECT 1 AS publish_channels
UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7
) AS pc
LEFT JOIN (
SELECT publish_channels ,dc_event.event_type eventType, COUNT(*)AS number
FROM dc_publish_manage
LEFT JOIN dc_event on dc_publish_manage.event_id=dc_event.id
GROUP BY dc_event.event_type
) AS m ON h.eventType = m.eventType AND pc.publish_channels = m.publish_channels
ORDER BY h.eventType, pc.publish_channels;
</select>
<select id="eventTypePublishManageMonth" resultType="java.util.HashMap">
SELECT h.eventType,
pc.publish_channels publishChannels,
COALESCE(m.number, 0) AS number
FROM (
SELECT 1 AS eventType
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
) AS h
CROSS JOIN (
SELECT 1 AS publish_channels
UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7
) AS pc
LEFT JOIN (
SELECT publish_channels ,dc_event.event_type eventType, COUNT(*)AS number
FROM dc_publish_manage
left join dc_event on dc_publish_manage.event_id=dc_event.id
WHERE YEAR(publish_time) = YEAR(CURDATE())
AND MONTH(publish_time) = MONTH(#{publishTime})
GROUP BY HOUR(publish_time), publish_channels
) AS m ON h.eventType = m.eventType AND pc.publish_channels = m.publish_channels
ORDER BY h.eventType, pc.publish_channels;
</select>
<select id="selectDcPublishManageStatistics" resultType="com.zc.business.domain.DcPublishManage">
select manage.id,IFNULL(event.stake_mark,log.dc_device_name)position,
manage.publisher,manage.publish_channels,manage.publish_status,manage.content_details,publish_time
from dc_publish_manage as manage
left join dc_event as event on event.id=manage.event_id
left join dc_oper_log as log on log.id=manage.log_id
<where>
<if test="publishChannels != null "> and manage.publish_channels = #{publishChannels}</if>
<if test="publishStatus != null "> and manage.publish_status = #{publishStatus}</if>
<if test="startTime != null and endTime != null ">
and manage.publish_time between #{startTime} and #{endTime}
</if>
</where>
ORDER BY publish_time desc
</select>
</mapper>