日照智慧社区接口服务
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.
 
 
 
 
 

95 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.ResiEventMentionDao">
<resultMap id="UserMentionResultDTOMap" type="com.epmet.dto.result.UserMentionResultDTO">
<id property="resiEventId" column="RESI_EVENT_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="attachmentList" ofType="com.epmet.dto.result.UserMentionResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
<!--<collection property="imgList" ofType="java.lang.String">
<constructor>
<arg column="img_url"/>
</constructor>
</collection>-->
</resultMap>
<select id="selectMentionList" parameterType="map" resultMap="UserMentionResultDTOMap">
SELECT
rem.RESI_EVENT_ID,
re.EVENT_CONTENT,
(
case when #{readFlag} ='un_read' then '0'
else rem.RED_DOT
end
)as RED_DOT,
re.`STATUS`,
re.SHIFT_PROJECT,
re.LATEST_OPERATED_TIME,
rea.id AS resiEventAttachmentId,
rea.attachment_url AS url,
rea.attachment_type AS type
FROM
resi_event_mention rem
LEFT JOIN resi_event re
ON ( rem.RESI_EVENT_ID = re.id AND re.audit_status = 'auto_passed')
LEFT JOIN resi_event_attachment rea
ON ( re.id = rea.RESI_EVENT_ID
AND rea.DEL_FLAG = '0'
AND rea.ATTACHMENT_TYPE = 'image')
WHERE
rem.DEL_FLAG = '0'
AND re.DEL_FLAG = '0'
AND re.RECALL_FLAG = '0'
AND rem.USER_ID = #{userId}
AND rem.READ_FLAG =#{readFlag}
<if test='readFlag == "un_read" '>
ORDER BY
re.CREATED_TIME ASC,rea.sort asc
</if>
<if test='readFlag == "read" '>
ORDER BY
re.LATEST_OPERATED_TIME DESC,rea.sort asc
</if>
</select>
<!-- 人大代表从未读-》已读,首次查看事件 -->
<update id="updateReadFlag" parameterType="map">
UPDATE resi_event_mention
SET READ_FLAG = 'read',
UPDATED_BY = #{userId},
UPDATED_TIME = NOW()
WHERE
RESI_EVENT_ID = #{eventId}
AND USER_ID = #{userId}
AND DEL_FLAG = '0'
</update>
<!-- 除了当前用户,都置为显示红点 -->
<update id="updateRedDotShow" parameterType="map">
UPDATE resi_event_mention
SET RED_DOT = '1',
UPDATED_TIME = NOW()
WHERE
RESI_EVENT_ID = #{resiEventId}
<if test="excludeUserId != null and excludeUserId.trim() != ''">
and user_id !=#{excludeUserId}
</if>
AND DEL_FLAG = '0'
</update>
<select id="selectUser" parameterType="map" resultType="com.epmet.entity.ResiEventMentionEntity">
select rem.* from resi_event_mention rem
where rem.del_flag='0'
and rem.RESI_EVENT_ID=#{eventId}
and rem.user_id=#{userId}
</select>
</mapper>