123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <?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.QwGroupChatUserMapper">
- <resultMap type="QwGroupChatUser" id="QwGroupChatUserResult">
- <result property="id" column="id" />
- <result property="chatId" column="chat_id" />
- <result property="userId" column="user_id" />
- <result property="type" column="type" />
- <result property="unionid" column="unionid" />
- <result property="joinTime" column="join_time" />
- <result property="joinScene" column="join_scene" />
- <result property="invitor" column="invitor" />
- <result property="groupNickname" column="group_nickname" />
- <result property="name" column="name" />
- <result property="companyId" column="company_id" />
- <result property="isOut" column="is_out" />
- <result property="corpId" column="corp_id" />
- <result property="outTime" column="out_time" />
- <result property="quitScene" column="quit_scene" />
- </resultMap>
- <sql id="selectQwGroupChatUserVo">
- select id, chat_id, user_id, type, unionid, join_time, join_scene, invitor, group_nickname, name, company_id, is_out, corp_id, out_time,quit_scene from qw_group_chat_user
- </sql>
- <select id="selectQwGroupChatUserList" parameterType="QwGroupChatUser" resultMap="QwGroupChatUserResult">
- <include refid="selectQwGroupChatUserVo"/>
- <where>
- <if test="chatId != null and chatId != ''"> and chat_id = #{chatId}</if>
- <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
- <if test="type != null and type != ''"> and type = #{type}</if>
- <if test="unionid != null "> and unionid = #{unionid}</if>
- <if test="joinTime != null "> and join_time = #{joinTime}</if>
- <if test="joinScene != null and joinScene != ''"> and join_scene = #{joinScene}</if>
- <if test="invitor != null and invitor != ''"> and invitor = #{invitor}</if>
- <if test="groupNickname != null and groupNickname != ''"> and group_nickname like concat('%', #{groupNickname}, '%')</if>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="isOut != null "> and is_out = #{isOut}</if>
- <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
- <if test="outTime != null "> and out_time = #{outTime}</if>
- <if test="quitScene != null "> and quit_scene = #{quitScene}</if>
- </where>
- order by join_time desc
- </select>
- <select id="selectQwGroupChatUserById" parameterType="Long" resultMap="QwGroupChatUserResult">
- <include refid="selectQwGroupChatUserVo"/>
- where id = #{id}
- </select>
- <select id="selectQwGroupChatUserByExternalUserId" parameterType="QwGroupChatUser" resultMap="QwGroupChatUserResult">
- <include refid="selectQwGroupChatUserVo"/>
- where chat_id = #{chatId} AND user_id=#{userId} AND corp_id=#{corpId}
- </select>
- <select id="selectQwGroupChatUserByChatIds" resultType="com.fs.qw.domain.QwGroupChatUser">
- select * from qw_group_chat_user where is_out = 1 and type = 2 and chat_id in <foreach collection="ids" open="(" separator="," close=")" item="item">#{item}</foreach>
- </select>
- <select id="selectUserIsChat" resultType="com.fs.qw.domain.QwGroupChatUser">
- select * from qw_group_chat_user a where a.user_id = #{externalUserId}
- </select>
- <select id="selectByChatId" resultType="com.fs.qw.domain.QwGroupChatUser">
- select * from qw_group_chat_user a where a.chat_id = #{chatId} and type = 2
- </select>
- <insert id="insertOrUpdateQwGroupChatUser" parameterType="QwGroupChatUser" useGeneratedKeys="true" keyProperty="id">
- insert into qw_group_chat_user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="chatId != null">chat_id,</if>
- <if test="userId != null">user_id,</if>
- <if test="type != null">type,</if>
- <if test="unionid != null">unionid,</if>
- <if test="joinTime != null">join_time,</if>
- <if test="joinScene != null">join_scene,</if>
- <if test="invitor != null">invitor,</if>
- <if test="groupNickname != null">group_nickname,</if>
- <if test="name != null">name,</if>
- <if test="companyId != null">company_id,</if>
- <if test="isOut != null">is_out,</if>
- <if test="corpId != null">corp_id,</if>
- <if test="outTime != null">out_time,</if>
- <if test="quitScene != null">quit_scene,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="chatId != null">#{chatId},</if>
- <if test="userId != null">#{userId},</if>
- <if test="type != null">#{type},</if>
- <if test="unionid != null">#{unionid},</if>
- <if test="joinTime != null">#{joinTime},</if>
- <if test="joinScene != null">#{joinScene},</if>
- <if test="invitor != null">#{invitor},</if>
- <if test="groupNickname != null">#{groupNickname},</if>
- <if test="name != null">#{name},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="isOut != null">#{isOut},</if>
- <if test="corpId != null">#{corpId},</if>
- <if test="outTime != null">#{outTime},</if>
- <if test="quitScene != null">#{quitScene},</if>
- </trim>
- on duplicate key update
- <trim suffixOverrides=",">
- <if test="type != null">type = #{type},</if>
- <if test="unionid != null">unionid = #{unionid},</if>
- <if test="joinTime != null">join_time = #{joinTime},</if>
- <if test="joinScene != null">join_scene = #{joinScene},</if>
- <if test="invitor != null">invitor = #{invitor},</if>
- <if test="groupNickname != null">group_nickname = #{groupNickname},</if>
- <if test="name != null">name = #{name},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="isOut != null">is_out = #{isOut},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="outTime != null">out_time = #{outTime},</if>
- <if test="quitScene != null">quit_scene = #{quitScene},</if>
- </trim>
- </insert>
- <insert id="insertQwGroupChatUser" parameterType="QwGroupChatUser" useGeneratedKeys="true" keyProperty="id">
- insert into qw_group_chat_user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="chatId != null">chat_id,</if>
- <if test="userId != null">user_id,</if>
- <if test="type != null">type,</if>
- <if test="unionid != null">unionid,</if>
- <if test="joinTime != null">join_time,</if>
- <if test="joinScene != null">join_scene,</if>
- <if test="invitor != null">invitor,</if>
- <if test="groupNickname != null">group_nickname,</if>
- <if test="name != null">name,</if>
- <if test="companyId != null">company_id,</if>
- <if test="isOut != null">is_out,</if>
- <if test="corpId != null">corp_id,</if>
- <if test="outTime != null">out_time,</if>
- <if test="quitScene != null">quit_scene,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="chatId != null">#{chatId},</if>
- <if test="userId != null">#{userId},</if>
- <if test="type != null">#{type},</if>
- <if test="unionid != null">#{unionid},</if>
- <if test="joinTime != null">#{joinTime},</if>
- <if test="joinScene != null">#{joinScene},</if>
- <if test="invitor != null">#{invitor},</if>
- <if test="groupNickname != null">#{groupNickname},</if>
- <if test="name != null">#{name},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="isOut != null">#{isOut},</if>
- <if test="corpId != null">#{corpId},</if>
- <if test="outTime != null">#{outTime},</if>
- <if test="quitScene != null">#{quitScene},</if>
- </trim>
- </insert>
- <update id="updateQwGroupChatUser" parameterType="QwGroupChatUser">
- update qw_group_chat_user
- <trim prefix="SET" suffixOverrides=",">
- <if test="chatId != null">chat_id = #{chatId},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="type != null">type = #{type},</if>
- <if test="unionid != null">unionid = #{unionid},</if>
- <if test="joinTime != null">join_time = #{joinTime},</if>
- <if test="joinScene != null">join_scene = #{joinScene},</if>
- <if test="invitor != null">invitor = #{invitor},</if>
- <if test="groupNickname != null">group_nickname = #{groupNickname},</if>
- <if test="name != null">name = #{name},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="isOut != null">is_out = #{isOut},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="outTime != null">out_time = #{outTime},</if>
- <if test="quitScene != null">quit_scene = #{quitScene},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="upDateDelGroupChatUser" parameterType="QwGroupChatUser">
- update qw_group_chat_user
- <trim prefix="SET" suffixOverrides=",">
- <if test="type != null">type = #{type},</if>
- <if test="unionid != null">unionid = #{unionid},</if>
- <if test="joinTime != null">join_time = #{joinTime},</if>
- <if test="joinScene != null">join_scene = #{joinScene},</if>
- <if test="invitor != null">invitor = #{invitor},</if>
- <if test="groupNickname != null">group_nickname = #{groupNickname},</if>
- <if test="name != null">name = #{name},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="isOut != null">is_out = #{isOut},</if>
- <if test="corpId != null">corp_id = #{corpId},</if>
- <if test="outTime != null">out_time = #{outTime},</if>
- <if test="quitScene != null">quit_scene = #{quitScene},</if>
- </trim>
- where chat_id = #{chatId} and user_id=#{userId}
- </update>
- <update id="groupChatUserJoinAgain" parameterType="QwGroupChatUser">
- update qw_group_chat_user
- <trim prefix="SET" suffixOverrides=",">
- type = #{type},
- unionid = #{unionid},
- join_time = #{joinTime},
- join_scene = #{joinScene},
- invitor = #{invitor},
- group_nickname = #{groupNickname},
- name = #{name},
- company_id = #{companyId},
- is_out = #{isOut},
- corp_id = #{corpId},
- out_time = #{outTime},
- quit_scene = #{quitScene}
- </trim>
- where chat_id = #{chatId} and user_id = #{userId}
- </update>
- <delete id="deleteQwGroupChatUserById" parameterType="Long">
- delete from qw_group_chat_user where id = #{id}
- </delete>
- <delete id="deleteQwGroupChatUserByIds" parameterType="String">
- delete from qw_group_chat_user where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|