<?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.wzj.soopin.im.mapper.SysMessageUserMapper">

    <resultMap type="com.wzj.soopin.im.domain.vo.SysMessageUserVo" id="SysMessageUserResult">
        <id     property="id"           column="id"            />
        <result property="messageId"    column="message_id"    />
        <result property="userId"       column="user_id"       />
        <result property="isRead"       column="is_read"       />
        <result property="readTime"     column="read_time"     />
<!--        <result property="createBy"     column="create_by"     />-->
<!--        <result property="createTime"   column="create_time"   />-->
<!--        <result property="updateBy"     column="update_by"     />-->
<!--        <result property="updateTime"   column="update_time"   />-->
<!--        <result property="tenantId"     column="tenant_id"     />-->
    </resultMap>

    <sql id="selectSysMessageUserVo">
        select id, message_id, user_id, is_read, read_time, create_time, update_time
        from sys_message_user
    </sql>

    <update id="updateReadStatus">
        update sys_message_user
        set is_read = #{isRead},
            read_time = sysdate()
        where message_id = #{messageId}
          and user_id = #{userId}
    </update>

</mapper>
