| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?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.fs.qw.mapper.QwConversationParticipantMapper">
- <resultMap id="BaseResultMap" type="com.fs.qw.domain.QwConversationParticipant">
- <id column="id" property="id"/>
- <result column="corp_id" property="corpId"/>
- <result column="msgid" property="msgid"/>
- <result column="participant_type" property="participantType"/>
- <result column="user_type" property="userType"/>
- <result column="user_id" property="userId"/>
- </resultMap>
- <sql id="Base_Column_List">
- id, corp_id, msgid, participant_type, user_type, user_id
- </sql>
- <!-- 插入参与者记录 -->
- <insert id="insert" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO qw_conversation_participant
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="corpId != null">corp_id,</if>
- <if test="msgid != null">msgid,</if>
- <if test="participantType != null">participant_type,</if>
- <if test="userType != null">user_type,</if>
- <if test="userId != null">user_id,</if>
- </trim>
- <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
- <if test="corpId != null">#{corpId},</if>
- <if test="msgid != null">#{msgid},</if>
- <if test="participantType != null">#{participantType},</if>
- <if test="userType != null">#{userType},</if>
- <if test="userId != null">#{userId},</if>
- </trim>
- </insert>
- <!-- 根据消息ID删除所有参与者 -->
- <delete id="deleteByMsgid">
- DELETE FROM qw_conversation_participant WHERE corp_id = #{corpId} AND msgid = #{msgid}
- </delete>
- <!-- 根据消息ID和参与者类型删除 -->
- <delete id="deleteByMsgidAndParticipantType">
- DELETE FROM qw_conversation_participant
- WHERE corp_id = #{corpId} AND msgid = #{msgid} AND participant_type = #{participantType}
- </delete>
- <!-- 根据消息ID查询参与者列表 -->
- <select id="selectByMsgid" resultMap="BaseResultMap">
- SELECT <include refid="Base_Column_List"/>
- FROM qw_conversation_participant
- WHERE corp_id = #{corpId} AND msgid = #{msgid}
- </select>
- <!-- 查询用户参与的所有消息ID(用于快速过滤) -->
- <select id="selectByUser" resultMap="BaseResultMap">
- SELECT <include refid="Base_Column_List"/>
- FROM qw_conversation_participant
- WHERE corp_id = #{corpId} AND user_type = #{userType} AND user_id = #{userId}
- </select>
- <select id="selectByMsgidAndType" resultMap="BaseResultMap">
- SELECT <include refid="Base_Column_List"/>
- FROM qw_conversation_participant
- WHERE corp_id = #{corpId} AND msgid = #{msgid} AND participant_type = #{participantType}
- </select>
- </mapper>
|