forked from luyan/epmet-cloud-lingshan
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.
562 lines
24 KiB
562 lines
24 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.epmet.dao.IcEventDao">
|
|
|
|
<!-- 更新评价,默认 perfect -->
|
|
<update id="updateAutoEvaluation">
|
|
UPDATE ic_event
|
|
SET SATISFACTION = 'perfect',
|
|
COMMENT_USER_ID = 'APP_USER',
|
|
COMMENT_TIME = NOW(),
|
|
LATEST_OPERATED_TIME = NOW(),
|
|
UPDATED_TIME = NOW()
|
|
WHERE ID IN (
|
|
<foreach collection="ids" item="id" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
)
|
|
</update>
|
|
|
|
<select id="getProcessStatusRatio" resultType="java.util.Map">
|
|
select STATUS status, count(1) eventCount
|
|
from ic_event e
|
|
<where>
|
|
<if test="orgType == 'agency'">
|
|
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
|
|
</if>
|
|
<if test="orgType == 'grid'">
|
|
and e.GRID_ID=#{orgId}
|
|
</if>
|
|
and e.DEL_FLAG = '0'
|
|
and CUSTOMER_ID = #{customerId}
|
|
and HAPPEN_TIME >= #{queryStartTime}
|
|
and HAPPEN_TIME <![CDATA[<=]]> #{queryEndTime}
|
|
</where>
|
|
group by STATUS
|
|
</select>
|
|
|
|
<select id="listProcessAnalysisEvents" resultType="com.epmet.dto.result.IcEventResultDTO">
|
|
select e.ID eventId,
|
|
e.GRID_ID gridId,
|
|
e.EVENT_CONTENT eventContent,
|
|
e.SOURCE_TYPE sourceType,
|
|
e.REPORT_USER_ID reportUserId,
|
|
e.NAME reportUserName,
|
|
e.MOBILE mobile,
|
|
e.STATUS processStatus,
|
|
e.happen_time happenTime
|
|
from ic_event e
|
|
<choose>
|
|
<!-- 如果是事件分类分析,那么用inner join;如果是处理分析,那么leftjoin查询所有事件 -->
|
|
<when test="biz != null and biz == 'eventCategoryAnalysis'">
|
|
inner join ic_event_category c on (e.ID = c.IC_EVENT_ID)
|
|
</when>
|
|
<otherwise>
|
|
left join ic_event_category c on (e.ID = c.IC_EVENT_ID)
|
|
</otherwise>
|
|
</choose>
|
|
<where>
|
|
e.CUSTOMER_ID = #{customerId}
|
|
AND e.DEL_FLAG = '0'
|
|
and e.HAPPEN_TIME >= #{queryStartTime}
|
|
and e.HAPPEN_TIME <![CDATA[<=]]> #{queryEndTime}
|
|
<if test="orgType == 'agency'">
|
|
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
|
|
</if>
|
|
<if test="orgType == 'grid'">
|
|
and e.GRID_ID=#{orgId}
|
|
</if>
|
|
<if test="processStatus != null and processStatus != ''">
|
|
and e.STATUS = #{processStatus}
|
|
</if>
|
|
<if test="categoryCode != null and categoryCode != ''">
|
|
and c.CATEGORY_CODE like CONCAT(#{categoryCode},'%')
|
|
</if>
|
|
</where>
|
|
order by e.happen_time desc
|
|
</select>
|
|
<select id="listMonthlyEventCount" resultType="com.epmet.dto.result.IcEventMonthlyCountResultDTO">
|
|
select t.monthName, count(1) eventCount
|
|
from (
|
|
select date_format(e.HAPPEN_TIME, '%Y-%m') monthName
|
|
from ic_event e
|
|
<where>
|
|
e.DEL_FLAG = '0'
|
|
and e.HAPPEN_TIME >= date_format(#{queryStartTime}, '%Y-%m')
|
|
and e.HAPPEN_TIME <![CDATA[ <= ]]> date_format(#{queryEndTime}, '%Y-%m')
|
|
<if test="orgType == 'grid'">
|
|
and e.GRID_ID =#{orgId}
|
|
</if>
|
|
<if test="orgType == 'agency'">
|
|
and e.GRID_PIDS like concat(#{gridPids},'%')
|
|
</if>
|
|
</where>
|
|
) t
|
|
group by t.monthName
|
|
|
|
</select>
|
|
|
|
<resultMap id="icEventMap" type="com.epmet.dto.result.IcEventListResultDTO">
|
|
<id property="icEventId" column="icEventId"/>
|
|
<result property="agencyId" column="agency_id"/>
|
|
<result property="gridId" column="grid_id"/>
|
|
<result property="reportUserId" column="report_user_id"/>
|
|
<result property="name" column="name" />
|
|
<result property="mobile" column="mobile" />
|
|
<result property="idCard" column="id_card" />
|
|
<result property="sourceType" column="source_type"/>
|
|
<result property="happenTime" column="happen_time"/>
|
|
<result property="eventContent" column="event_content"/>
|
|
<result property="latitude" column="latitude"/>
|
|
<result property="longitude" column="longitude"/>
|
|
<result property="address" column="address"/>
|
|
<result property="status" column="status"/>
|
|
<result property="statusName" column="statusName" />
|
|
<result property="closeCaseTime" column="close_case_time"/>
|
|
<result property="satisfaction" column="satisfaction"/>
|
|
<result property="satisfactionName" column="satisfactionName" />
|
|
<result property="operationType" column="operation_type"/>
|
|
<result property="operationTypeName" column="operationTypeName"/>
|
|
<result property="operationId" column="operation_id"/>
|
|
<result property="readFlag" column="read_flag"/>
|
|
<result property="redDot" column="red_dot"/>
|
|
<result property="govRedDot" column="gov_red_dot"/>
|
|
<result property="latestOperatedTime" column="latest_operated_time"/>
|
|
<result property="resolveStatus" column="resolve_status"/>
|
|
<result property="closeRemark" column="close_remark"/>
|
|
<result property="commentUserId" column="comment_user_id"/>
|
|
<result property="commentTime" column="comment_time" />
|
|
<result property="createdTime" column="created_time" />
|
|
<result property="createdUserId" column="created_by" />
|
|
<result property="categoryId" column="category_id" />
|
|
<result property="difficultPoint" column="difficult_point" />
|
|
<result property="difficultPointName" column="difficultPointName" />
|
|
<collection property="attachmentList" ofType="com.epmet.dto.result.IcEventListResultDTO$Attachment"
|
|
column="icEventId" select="matterListByPartyServiceCenterId"/>
|
|
<!--<collection property="attachmentList" ofType="com.epmet.dto.result.IcEventListResultDTO$Attachment" select="">
|
|
<result column="icEventAttachmentId"/><!– 附件表ID,如果附件url和type一样会被去重 加上id就可以了 –>
|
|
<result column="url" property="url"/>
|
|
<result column="type" property="type"/>
|
|
<result column="duration" property="duration"/>
|
|
</collection>-->
|
|
</resultMap>
|
|
<select id="matterListByPartyServiceCenterId" resultType="com.epmet.dto.result.IcEventListResultDTO$Attachment">
|
|
SELECT
|
|
rea.attachment_url AS url,
|
|
rea.attachment_type AS type,
|
|
rea.duration AS duration
|
|
from ic_event_attachment rea
|
|
where rea.del_flag = '0'
|
|
and rea.ic_event_id = #{icEventId}
|
|
order by attachment_type asc, rea.sort asc
|
|
</select>
|
|
<select id="icEventList" parameterType="map" resultMap="icEventMap">
|
|
SELECT
|
|
ie.id icEventId,
|
|
ie.agency_id,
|
|
ie.grid_id,
|
|
ie.report_user_id,
|
|
ie.`name`,
|
|
ie.mobile,
|
|
ie.id_card,
|
|
ie.source_type,
|
|
ie.happen_time,
|
|
ie.event_content,
|
|
ie.latitude,
|
|
ie.longitude,
|
|
ie.address,
|
|
ie.`status`,
|
|
IF(ie.status = 'processing','处理中',IF (ie.status = 'closed_case','已办结','')) statusName,
|
|
ie.close_case_time,
|
|
ie.satisfaction,
|
|
IF(ie.satisfaction = 'bad','不满意',IF (ie.satisfaction = 'good','基本满意',IF (ie.satisfaction = 'perfect','非常满意',''))) satisfactionName,
|
|
ie.operation_type,
|
|
(
|
|
case when ie.operation_type = '0' then '已回复'
|
|
when ie.operation_type = '1' then '已转项目'
|
|
when ie.operation_type = '2' then '已转需求'
|
|
when ie.operation_type = '3' then '已转议题'
|
|
else ''
|
|
end
|
|
)as operationTypeName,
|
|
ie.operation_id,
|
|
ie.read_flag,
|
|
ie.red_dot,
|
|
ie.gov_red_dot,
|
|
ie.latest_operated_time,
|
|
ie.resolve_status,
|
|
ie.close_remark,
|
|
ie.comment_user_id,
|
|
ie.comment_time,
|
|
ie.created_time,
|
|
ie.created_by,
|
|
iec.category_id,
|
|
ie.difficult_point,
|
|
IF(ie.difficult_point = '1','是','否') difficultPointName
|
|
FROM
|
|
ic_event ie
|
|
LEFT JOIN ic_event_category iec ON(ie.id = iec.ic_event_id AND iec.del_flag = '0')
|
|
WHERE
|
|
ie.del_flag = '0'
|
|
<if test="icEventId != null and icEventId != '' ">
|
|
AND ie.id = #{icEventId}
|
|
</if>
|
|
<if test="gridId != null and gridId != '' ">
|
|
AND ie.grid_id = #{gridId}
|
|
</if>
|
|
<if test="agencyId != null and agencyId != '' ">
|
|
AND ie.grid_pids LIKE CONCAT('%', #{agencyId}, '%')
|
|
</if>
|
|
<if test="sourceType != null and sourceType != '' ">
|
|
AND ie.source_type = #{sourceType}
|
|
</if>
|
|
<if test="eventContent != null and eventContent != '' ">
|
|
AND ie.event_content LIKE CONCAT('%', #{eventContent}, '%')
|
|
</if>
|
|
<if test="name != null and name != '' ">
|
|
AND ie.`name` LIKE CONCAT('%', #{name}, '%')
|
|
</if>
|
|
<if test="mobile != null and mobile != '' ">
|
|
AND ie.mobile = #{mobile}
|
|
</if>
|
|
<if test="startTime != null and startTime != '' ">
|
|
AND DATE_FORMAT(ie.happen_time,"%Y-%m-%d %H:%i") <![CDATA[>=]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != '' ">
|
|
AND DATE_FORMAT(ie.happen_time,"%Y-%m-%d %H:%i") <![CDATA[<=]]> #{endTime}
|
|
</if>
|
|
<if test="status != null and status != '' ">
|
|
AND ie.`status` = #{status}
|
|
</if>
|
|
<if test="(firstIdList != null and firstIdList.size() > 0) and (secondIdList == null or secondIdList.size() == 0)"><!-- 一类查询条件 -->
|
|
<foreach collection="firstIdList" item="firstId" open="AND iec.CATEGORY_PIDS IN (" separator="," close=")">
|
|
#{firstId}
|
|
</foreach>
|
|
</if>
|
|
<if test="(secondIdList != null and secondIdList.size() > 0) and (firstIdList == null or firstIdList.size() == 0)"><!-- 二类查询条件 -->
|
|
<foreach collection="secondIdList" item="secondId" open="AND iec.CATEGORY_ID IN (" separator="," close=")">
|
|
#{secondId}
|
|
</foreach>
|
|
</if>
|
|
<if test="(secondIdList != null and secondIdList.size() > 0) and (firstIdList != null and firstIdList.size() > 0)"><!-- 二类查询条件 -->
|
|
<foreach collection="firstIdList" item="firstId" open="AND (iec.CATEGORY_PIDS IN (" separator="," close=")">
|
|
#{firstId}
|
|
</foreach>
|
|
<foreach collection="secondIdList" item="secondId" open="OR iec.CATEGORY_ID IN (" separator="," close="))">
|
|
#{secondId}
|
|
</foreach>
|
|
</if>
|
|
order by ie.happen_time desc, ie.latest_operated_time desc
|
|
</select>
|
|
|
|
<select id="listEventsByPCategoryInOrg" resultType="com.epmet.dto.result.IcEventResultDTO">
|
|
select e.ID as eventId, e.ADDRESS
|
|
from ic_event e
|
|
inner join ic_event_category c on (e.ID = c.IC_EVENT_ID)
|
|
<where>
|
|
<if test="orgType == 'grid'">
|
|
e.GRID_ID = #{orgId}
|
|
</if>
|
|
<if test="orgType == 'agency'">
|
|
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
|
|
</if>
|
|
and c.CATEGORY_PIDS like CONCAT(#{categoryPids},'%')
|
|
</where>
|
|
order by e.HAPPEN_TIME desc
|
|
</select>
|
|
|
|
<select id="selectFirstCategoryTotal" parameterType="com.epmet.dto.form.IcEventCategoryAnalysisFormDTO" resultType="com.epmet.dto.result.IcEventCategoryAnalysisResDTO">
|
|
SELECT LEFT
|
|
( c.CATEGORY_CODE, #{categoryOneLength} ) CATEGORY_CODE,
|
|
COUNT( DISTINCT c.IC_EVENT_ID ) total
|
|
FROM
|
|
ic_event_category c
|
|
LEFT JOIN ic_event e ON ( c.IC_EVENT_ID = e.ID AND e.DEL_FLAG = '0' )
|
|
WHERE
|
|
c.DEL_FLAG = '0'
|
|
AND c.CUSTOMER_ID = #{customerId}
|
|
and e.HAPPEN_TIME >= #{queryStartTime}
|
|
and e.HAPPEN_TIME <![CDATA[<=]]> #{queryEndTime}
|
|
<if test="orgType == 'agency'">
|
|
and e.GRID_PIDS like CONCAT(#{gridPids},'%')
|
|
</if>
|
|
<if test="orgType == 'grid'">
|
|
and e.GRID_ID=#{orgId}
|
|
</if>
|
|
GROUP BY
|
|
LEFT ( c.CATEGORY_CODE, #{categoryOneLength} )
|
|
ORDER BY
|
|
total DESC
|
|
</select>
|
|
|
|
<!-- 查询客户下可以自动评价事件的ID -->
|
|
<select id="getAutoEvaluationIds" resultType="java.lang.String">
|
|
SELECT ID
|
|
FROM ic_event
|
|
WHERE DEL_FLAG = '0'
|
|
AND CUSTOMER_ID = #{customerId}
|
|
AND `STATUS` = 'closed_case'
|
|
AND SATISFACTION = null
|
|
AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(CLOSE_CASE_TIME) > 60*60*24*7
|
|
LIMIT #{no},#{size}
|
|
</select>
|
|
|
|
<!-- 事件分类分析 饼图2:下一级组织+直属网格事件数量 -->
|
|
<select id="selectOrgTotal" parameterType="com.epmet.dto.form.IcEventCategoryAnalysisFormDTO" resultType="java.lang.Integer">
|
|
SELECT
|
|
count( ie.id ) as total
|
|
FROM
|
|
ic_event ie
|
|
inner join ic_event_category ic
|
|
on(ie.ID=ic.IC_EVENT_ID and ic.DEL_FLAG='0')
|
|
WHERE
|
|
ie.DEL_FLAG = '0'
|
|
AND ie.CUSTOMER_ID = #{customerId}
|
|
and ie.HAPPEN_TIME >= #{queryStartTime}
|
|
and ie.HAPPEN_TIME <![CDATA[<=]]> #{queryEndTime}
|
|
<if test="orgType == 'agency'">
|
|
and ie.GRID_PIDS like CONCAT(#{gridPids},'%')
|
|
</if>
|
|
<if test="orgType == 'grid'">
|
|
AND ie.GRID_ID = #{orgId}
|
|
</if>
|
|
<if test="categoryCode != null and categoryCode != '' ">
|
|
and ic.CATEGORY_CODE like concat(#{categoryCode},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<resultMap id="MyReportIcEvResDTOMap" type="com.epmet.dto.result.MyReportIcEvResDTO">
|
|
<id property="icEventId" column="icEventId"/>
|
|
<result property="happenTime" column="happen_time"/>
|
|
<result property="eventContent" column="event_content"/>
|
|
<result property="address" column="address"/>
|
|
<result property="status" column="status"/>
|
|
<result property="statusName" column="statusName" />
|
|
<result property="operationType" column="operation_type"/>
|
|
<result property="operationId" column="operation_id"/>
|
|
<result property="redDot" column="red_dot"/>
|
|
<result property="replyFlag" column="reply_flag"></result>
|
|
<result property="latestOperatedTime" column="latest_operated_time"></result>
|
|
<result property="satisfaction" column="satisfaction"/>
|
|
<result property="satisfactionName" column="satisfactionName" />
|
|
<result property="categoryId" column="category_id" />
|
|
<collection property="attachmentList" ofType="com.epmet.dto.IcEventAttachmentDTO"
|
|
column="icEventId" select="com.epmet.dao.IcEventAttachmentDao.selectByIcEventId"/>
|
|
</resultMap>
|
|
|
|
<select id="selectMyReport" parameterType="com.epmet.dto.form.MyReportIcEvFormDTO" resultMap="MyReportIcEvResDTOMap">
|
|
SELECT
|
|
ie.id as icEventId,
|
|
ie.happen_time,
|
|
ie.event_content,
|
|
ie.address,
|
|
ie.`status`,
|
|
IF(ie.status = 'processing','处理中',IF (ie.status = 'closed_case','已办结','')) statusName,
|
|
IFNULL(ie.operation_type,'') AS operation_type,
|
|
IFNULL(ie.operation_id,'') AS operation_id,
|
|
ie.red_dot,
|
|
ie.latest_operated_time,
|
|
IFNULL(ie.satisfaction,'') as satisfaction,
|
|
(
|
|
case when satisfaction is null or satisfaction='' then ''
|
|
when satisfaction='bad' then '不满意'
|
|
when satisfaction='good' then '基本满意'
|
|
when satisfaction='perfect' then '非常满意'
|
|
else ''
|
|
end
|
|
) as satisfactionName,
|
|
(
|
|
case when ie.status='processing' and ie.OPERATION_TYPE is not null and ie.OPERATION_TYPE ='0' then 1
|
|
else 0
|
|
end
|
|
)as reply_flag,
|
|
IFNULL(iec.category_id,'') AS category_id
|
|
FROM
|
|
ic_event ie
|
|
LEFT JOIN ic_event_category iec
|
|
ON(ie.id = iec.ic_event_id
|
|
AND iec.del_flag = '0')
|
|
WHERE
|
|
ie.del_flag = '0'
|
|
and ie.customer_id = #{customerId}
|
|
<if test="status != null and status != '' ">
|
|
AND ie.`status` = #{status}
|
|
</if>
|
|
<if test="userId != null and userId != '' ">
|
|
AND ie.REPORT_USER_ID = #{userId}
|
|
</if>
|
|
<if test="icEventId != null and icEventId != '' ">
|
|
AND ie.id = #{icEventId}
|
|
</if>
|
|
order by ie.latest_operated_time desc
|
|
</select>
|
|
|
|
<update id="updateRedDot" parameterType="map">
|
|
UPDATE ic_event
|
|
SET UPDATED_BY = #{userId},
|
|
UPDATED_TIME = NOW(),
|
|
RED_DOT = '0'
|
|
WHERE
|
|
id = #{icEventId}
|
|
AND DEL_FLAG = '0'
|
|
</update>
|
|
|
|
<select id="getResiReportEventCount" resultType="java.lang.Integer">
|
|
select count(*) c
|
|
from ic_event e
|
|
where e.ID_CARD = #{reportorIdCard}
|
|
and e.DEL_FLAG = '0'
|
|
</select>
|
|
|
|
<select id="getByEventIds" resultType="com.epmet.dto.IcEventDTO">
|
|
SELECT
|
|
id
|
|
FROM
|
|
ic_event
|
|
WHERE
|
|
del_flag = '0'
|
|
<foreach collection="icEventIdList" item="id" open="AND id IN (" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
AND (`status` = 'closed_case' OR difficult_point = '1')<!-- 已结案的或已标记为难点堵点的 -->
|
|
</select>
|
|
|
|
|
|
<select id="selectUserReported" resultType="com.epmet.dto.result.PageUserReportEventResDTO">
|
|
SELECT
|
|
re.id AS resiEventId,
|
|
re.event_content AS eventContent,
|
|
if(re.operation_type='1', '1', '0') AS shiftProject,
|
|
if(re.operation_type='1', re.operation_id, '') AS projectId,
|
|
re.created_time AS reportTime
|
|
FROM
|
|
ic_event re
|
|
WHERE
|
|
re.del_flag = '0'
|
|
<foreach item="epmetUserId" collection="epmetUserIdList" open="AND (" separator="or" close=")" index="">
|
|
re.report_user_id = #{epmetUserId}
|
|
</foreach>
|
|
ORDER BY re.created_time desc
|
|
</select>
|
|
|
|
<select id="getEventRate" resultType="com.epmet.dto.result.EventRateResultDTO">
|
|
SELECT
|
|
ea.countAll AS total,
|
|
eb.hong AS hongDeng,
|
|
ec.huang AS huangDeng,
|
|
ed.lan as lanDeng,
|
|
ee.dang as guiDang,
|
|
ROUND( eb.hong / ea.countAll, 2 ) AS hongDengRate,
|
|
ROUND( ec.huang / ea.countAll, 2 ) AS huangDengRate,
|
|
ROUND( ed.lan / ea.countAll, 2 ) as lanDengRate,
|
|
ROUND( ee.dang / ea.countAll, 2) as guiDangRate
|
|
FROM
|
|
( SELECT
|
|
SUM( CASE WHEN a.OPERATION_TYPE IS NULL OR a.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) AS countAll
|
|
FROM
|
|
ic_event a
|
|
WHERE
|
|
a.DEL_FLAG = 0
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and a.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
) ea,
|
|
( SELECT SUM( CASE WHEN b.OPERATION_TYPE IS NULL THEN 1 ELSE 0 END ) AS hong
|
|
FROM ic_event b WHERE b.DEL_FLAG = 0 and b.STATUS = 'processing'
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and b.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
<if test="null != eventType and eventType !=''">
|
|
AND b.SOURCE_TYPE = #{eventType}
|
|
</if>
|
|
) eb,
|
|
( SELECT SUM( CASE WHEN c.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) AS huang
|
|
FROM ic_event c WHERE c.DEL_FLAG = 0 and c.STATUS = 'processing'
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and c.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
<if test="null != eventType and eventType !=''">
|
|
AND c.SOURCE_TYPE = #{eventType}
|
|
</if>
|
|
) ec,
|
|
( SELECT SUM( CASE WHEN d.OPERATION_TYPE = 0 THEN 1 ELSE 0 END ) as lan
|
|
FROM ic_event d WHERE d.DEL_FLAG = 0 and d.STATUS = 'closed_case'
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and d.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
<if test="null != eventType and eventType !=''">
|
|
AND d.SOURCE_TYPE = #{eventType}
|
|
</if>
|
|
) ed,
|
|
( SELECT SUM( CASE WHEN d.DIFFICULT_POINT = 1 THEN 1 ELSE 0 END) as dang
|
|
FROM ic_event d WHERE d.DEL_FLAG = 0
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and d.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
<if test="null != eventType and eventType !=''">
|
|
AND d.SOURCE_TYPE = #{eventType}
|
|
</if>
|
|
) ee
|
|
</select>
|
|
|
|
<select id="getEventAnalysis" resultType="com.epmet.dto.result.EventAnalysisResultDTO">
|
|
SELECT
|
|
ea.total AS jiSuJiBan,
|
|
eb.total AS zhiTongLianBan,
|
|
ec.total AS wangGeHua,
|
|
ed.total AS guiDang
|
|
FROM
|
|
(
|
|
SELECT COUNT( e.id ) AS total
|
|
|
|
FROM ic_event e
|
|
WHERE e.DEL_FLAG = 0 AND e.SOURCE_TYPE = 0 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and e.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
) ea,
|
|
(
|
|
SELECT COUNT( e.id ) AS total FROM ic_event e
|
|
WHERE e.DEL_FLAG = 0 AND e.SOURCE_TYPE = 1 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and e.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
) eb,
|
|
(
|
|
SELECT COUNT( e.id ) AS total FROM ic_event e
|
|
WHERE e.DEL_FLAG = 0 AND e.SOURCE_TYPE = 2 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and e.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
) ec,
|
|
(
|
|
SELECT COUNT( e.id ) AS total FROM ic_event e
|
|
WHERE e.DEL_FLAG = 0 AND e.DIFFICULT_POINT = 1 AND ( e.OPERATION_TYPE = 0 OR e.OPERATION_TYPE IS NULL )
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and e.GRID_PIDS like concat(#{orgIdPath},'%')
|
|
</if>
|
|
) ed
|
|
|
|
</select>
|
|
|
|
<select id="getAnalysis" resultType="java.util.Map">
|
|
SELECT
|
|
c.CATEGORY_ID as code,
|
|
COUNT(c.CATEGORY_ID) as total
|
|
FROM ic_event_category c
|
|
<where>
|
|
c.IC_EVENT_ID in (
|
|
SELECT ic.id as ids from ic_event ic WHERE ic.DEL_FLAG = 0
|
|
<if test="null != orgIdPath and orgIdPath != ''">
|
|
and ic.GRID_PIDS LIKE concat(#{orgIdPath},'%')
|
|
</if>
|
|
)
|
|
</where>
|
|
GROUP BY c.CATEGORY_ID
|
|
</select>
|
|
|
|
<select id="selectByEventId" resultType="com.epmet.entity.IcEventEntity">
|
|
select e.* from ic_event e where e.id = #{icEventId}
|
|
</select>
|
|
</mapper>
|
|
|