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.

90 lines
3.7 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.ResiEventDao">
4 years ago
<!-- 查询报事列表 -->
<resultMap id="eventUnDisposedListMap" type="com.epmet.dto.result.EventListResultDTO">
<result property="eventContent" column="eventContent"/>
<result property="eventId" column="eventId"/>
<result property="eventTime" column="eventTime"/>
<result property="isProject" column="isProject"/>
<result property="redDot" column="redDot"/>
<collection property="eventImgs" ofType="java.lang.String">
<result column="img"/>
</collection>
</resultMap>
<select id="eventUnDisposedList" resultMap="eventUnDisposedListMap">
SELECT IFNULL(rea.ATTACHMENT_URL,'') AS img,t.* FROM
(SELECT
re.EVENT_CONTENT AS eventContent,
IFNULL(DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i:%s'),'') AS eventTime,
re.ID AS eventId,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
(CASE WHEN ro.RED_DOT = 1 THEN TRUE ELSE FALSE END) AS redDot
FROM resi_event_report_org ro
INNER JOIN resi_event re ON (ro.RESI_EVENT_ID = re.ID AND re.DEL_FLAG = '0')
AND ro.DEL_FLAG = '0'
<if test='eventType == "undisposed" '>
AND ro.ORG_READ = 'un_read'
ORDER BY re.CREATED_TIME
</if>
<if test='eventType == "processed" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'processing'
ORDER BY re.LATEST_OPERATED_TIME
</if>
<if test='eventType == "transferred" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'closed_case'
ORDER BY re.CLOSE_CASE_TIME
</if>
)t
LEFT JOIN resi_event_attachment rea ON (rea.RESI_EVENT_ID = t.eventId AND rea.DEL_FLAG = '0' AND rea.ATTACHMENT_TYPE = 'image' AND (rea.SORT = 0 OR rea.SORT = 1 OR rea.SORT = 2))
</select>
4 years ago
<resultMap id="MyReportedResultDTOMap" type="com.epmet.dto.result.MyReportedResultDTO">
<id property="resiEventId" column="id"/>
<result property="eventContent" column="EVENT_CONTENT"/>
<result property="redDot" column="RED_DOT" />
<result property="status" column="STATUS" />
<result property="shiftProject" column="SHIFT_PROJECT" />
<result property="showTime" column="LATEST_OPERATED_TIME" />
<collection property="imgList" ofType="java.lang.String">
<constructor>
<arg column="img_url"/>
</constructor>
</collection>
</resultMap>
<select id="queryMyReported" parameterType="map" resultMap="MyReportedResultDTOMap">
select
re.id,
re.EVENT_CONTENT,
(
case when #{statusCondition} ='un_read' then '0'
else re.RED_DOT
end
)as RED_DOT,
re.`STATUS`,
re.SHIFT_PROJECT,
re.LATEST_OPERATED_TIME,
rea.ATTACHMENT_URL as img_url
from resi_event re
left join resi_event_attachment rea
on(re.id=rea.RESI_EVENT_ID
and rea.DEL_FLAG='0'
and rea.ATTACHMENT_TYPE='image')
4 years ago
where re.DEL_FLAG='0'
and re.RECALL_FLAG='0'
and re.REPORT_USER_ID=#{userId}
<if test='statusCondition == "un_read" '>
and re.READ_FLAG='0'
</if>
<if test='statusCondition != "un_read" '>
and re.`STATUS`=#{statusCondition}
</if>
order by re.LATEST_OPERATED_TIME desc
</select>
</mapper>