|
|
@@ -0,0 +1,77 @@
|
|
|
+<?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.ytpm.dao.MessageMapper">
|
|
|
+ <select id="getUnreadMessage" resultType="com.ytpm.middle.view.MessageVO">
|
|
|
+ select
|
|
|
+ pm.message_id,
|
|
|
+ pm.message_type,
|
|
|
+ pm.message_title,
|
|
|
+ pm.message_content,
|
|
|
+ pm.message_status,
|
|
|
+ pm.send_time,
|
|
|
+ pm.send_type,
|
|
|
+ pm.create_time,
|
|
|
+ pm.create_user_id,
|
|
|
+ pm.update_time,
|
|
|
+ pm.update_user_id,
|
|
|
+ pm.available
|
|
|
+ from yt_platform_message_record pmr
|
|
|
+ join yt_platform_message pm on pmr.message_id = pm.message_id
|
|
|
+ where pmr.recipient = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryMessage" resultType="com.ytpm.middle.model.YtPlatformMessage">
|
|
|
+ select
|
|
|
+ message_id, message_type, message_title, message_content, message_status, send_time, send_type, create_time, create_user_id, update_time, update_user_id, available
|
|
|
+ from yt_platform_message
|
|
|
+ where message_id = #{messageId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryUnreadRecord" resultType="com.ytpm.middle.view.MessageRecordVO">
|
|
|
+ select
|
|
|
+ record_id, message_id, recipient, recipient_status, recipient_time, create_user_id, create_time, update_user_id, update_time, available
|
|
|
+ from yt_platform_message_record
|
|
|
+ where recipient_status = 0 and message_id = #{messageId} and recipient not in (#{userId})
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="markRead">
|
|
|
+ update yt_platform_message_record
|
|
|
+ set recipient_status = 1, update_user_id = #{userId}, update_time = now()
|
|
|
+ where message_id = #{messageId} and recipient = #{userId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateById">
|
|
|
+ update yt_platform_message
|
|
|
+ <set>
|
|
|
+ <if test="messageType != null">
|
|
|
+ message_type = #{messageType},
|
|
|
+ </if>
|
|
|
+ <if test="messageTitle != null">
|
|
|
+ message_title = #{messageTitle},
|
|
|
+ </if>
|
|
|
+ <if test="messageContent != null">
|
|
|
+ message_content = #{messageContent},
|
|
|
+ </if>
|
|
|
+ <if test="messageStatus != null">
|
|
|
+ message_status = #{messageStatus},
|
|
|
+ </if>
|
|
|
+ <if test="sendTime != null">
|
|
|
+ send_time = #{sendTime},
|
|
|
+ </if>
|
|
|
+ <if test="sendType != null">
|
|
|
+ send_type = #{sendType},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateUserId != null">
|
|
|
+ update_user_id = #{updateUserId},
|
|
|
+ </if>
|
|
|
+ <if test="available != null">
|
|
|
+ available = #{available}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where message_id = #{messageId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|