<?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.ag.log.mapper.RemqMsgCustomMapper">

    <resultMap id="BaseResultMap" type="com.ag.log.RemqMsgCustom">
            <id property="id" column="ID" jdbcType="VARCHAR"/>
            <result property="businessKey" column="BUSINESS_KEY" jdbcType="VARCHAR"/>
            <result property="businessType" column="BUSINESS_TYPE" jdbcType="VARCHAR"/>
            <result property="businessUrl" column="BUSINESS_URL" jdbcType="VARCHAR"/>
            <result property="msgInfo" column="MSG_INFO" jdbcType="VARCHAR"/>
            <result property="receiveFlag" column="RECEIVE_FLAG" jdbcType="CHAR"/>
            <result property="receiveTim" column="RECEIVE_TIM" jdbcType="TIMESTAMP"/>
            <result property="createdBy" column="CREATED_BY" jdbcType="VARCHAR"/>
            <result property="createdOn" column="CREATED_ON" jdbcType="TIMESTAMP"/>
            <result property="updatedBy" column="UPDATED_BY" jdbcType="VARCHAR"/>
            <result property="updatedOn" column="UPDATED_ON" jdbcType="TIMESTAMP"/>
            <result property="chatName" column="CHAT_NAME" jdbcType="VARCHAR"/>
            <result property="srFlag" column="SR_FLAG" jdbcType="CHAR"/>
            <result property="reUserId" column="RE_USER_ID" jdbcType="VARCHAR"/>
            <result property="parentId" column="PARENT_ID" jdbcType="VARCHAR"/>
            <result property="msgId" column="MSG_ID" jdbcType="VARCHAR"/>
            <result property="assignReceiveMan" column="ASSIGN_RECEIVE_MAN" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        ID,BUSINESS_KEY,BUSINESS_TYPE,
        BUSINESS_URL,MSG_INFO,RECEIVE_FLAG,
        RECEIVE_TIM,CREATED_BY,CREATED_ON,
        UPDATED_BY,UPDATED_ON,CHAT_NAME,
        SR_FLAG,RE_USER_ID,PARENT_ID,
        MSG_ID,ASSIGN_RECEIVE_MAN
    </sql>


    <select id="queryNoRead" parameterType="java.lang.String" resultType="java.lang.Integer">
        SELECT COUNT(1) FROM REMQ_MSG_CUSTOM WHERE RECEIVE_FLAG='0' AND RE_USER_ID=#{reUserId,jdbcType=VARCHAR} AND SR_FLAG='R'
    </select>
    <update id="markMsg" parameterType="List">
        UPDATE REMQ_MSG_CUSTOM SET RECEIVE_FLAG='1' WHERE ID  IN
        <foreach close=")" collection="list" item="item" open="(" separator=",">
            #{item}
        </foreach>
    </update>
</mapper>
