| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?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.chat.mapper.ChatMsgMapper">
- <resultMap type="ChatMsg" id="ChatMsgResult">
- <result property="msgId" column="msg_id" />
- <result property="sessionId" column="session_id" />
- <result property="extId" column="ext_id" />
- <result property="content" column="content" />
- <result property="msgType" column="msg_type" />
- <result property="sendType" column="send_type" />
- <result property="companyId" column="company_id" />
- <result property="roleId" column="role_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="createTime" column="create_time" />
- <result property="msgJson" column="msg_json" />
- <result property="userId" column="user_id" />
- <result property="status" column="status" />
- <result property="nickName" column="nick_name" />
- <result property="avatar" column="avatar" />
- <result property="userType" column="user_type" />
- </resultMap>
- <sql id="selectChatMsgVo">
- select msg_id,session_id,nick_name, avatar,ext_id, content,status,msg_type, send_type, company_id, role_id, company_user_id, create_time, msg_json,user_id,user_type from chat_msg
- </sql>
- <select id="selectChatMsgList" parameterType="ChatMsg" resultMap="ChatMsgResult">
- <include refid="selectChatMsgVo"/>
- <where>
- <if test="extId != null and extId != ''"> and ext_id = #{extId}</if>
- <if test="sessionId != null "> and session_id = #{sessionId}</if>
- <if test="content != null and content != ''"> and content = #{content}</if>
- <if test="msgType != null "> and msg_type = #{msgType}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="sendType != null "> and send_type = #{sendType}</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="roleId != null "> and role_id = #{roleId}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- <if test="msgJson != null and msgJson != ''"> and msg_json = #{msgJson}</if>
- <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
- AND date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
- AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- </where>
- </select>
- <select id="selectChatMsgByMsgId" parameterType="Long" resultMap="ChatMsgResult">
- <include refid="selectChatMsgVo"/>
- where msg_id = #{msgId}
- </select>
- <insert id="insertChatMsg" parameterType="ChatMsg" useGeneratedKeys="true" keyProperty="msgId">
- insert into chat_msg
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="extId != null">ext_id,</if>
- <if test="sessionId != null">session_id,</if>
- <if test="content != null">content,</if>
- <if test="msgType != null">msg_type,</if>
- <if test="sendType != null">send_type,</if>
- <if test="companyId != null">company_id,</if>
- <if test="roleId != null">role_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="createTime != null">create_time,</if>
- <if test="msgJson != null">msg_json,</if>
- <if test="userId != null">user_id,</if>
- <if test="status != null">status,</if>
- <if test="avatar != null">avatar,</if>
- <if test="nickName != null">nick_name,</if>
- <if test="userType != null">user_type,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="extId != null">#{extId},</if>
- <if test="sessionId != null">#{sessionId},</if>
- <if test="content != null">#{content},</if>
- <if test="msgType != null">#{msgType},</if>
- <if test="sendType != null">#{sendType},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="roleId != null">#{roleId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="msgJson != null">#{msgJson},</if>
- <if test="userId != null">#{userId},</if>
- <if test="status != null">#{status},</if>
- <if test="avatar != null">#{avatar},</if>
- <if test="nickName != null">#{nickName},</if>
- <if test="userType != null">#{userType},</if>
- </trim>
- </insert>
- <update id="updateChatMsg" parameterType="ChatMsg">
- update chat_msg
- <trim prefix="SET" suffixOverrides=",">
- <if test="extId != null">ext_id = #{extId},</if>
- <if test="sessionId != null">session_id = #{sessionId},</if>
- <if test="content != null">content = #{content},</if>
- <if test="msgType != null">msg_type = #{msgType},</if>
- <if test="sendType != null">send_type = #{sendType},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="roleId != null">role_id = #{roleId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="msgJson != null">msg_json = #{msgJson},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="status != null">status = #{status},</if>
- <if test="avatar != null">avatar = #{avatar},</if>
- <if test="nickName != null">nick_name = #{nickName},</if>
- <if test="userType != null">user_type = #{userType},</if>
- </trim>
- where msg_id = #{msgId}
- </update>
- <delete id="deleteChatMsgByMsgId" parameterType="Long">
- delete from chat_msg where msg_id = #{msgId}
- </delete>
- <delete id="deleteChatMsgByMsgIds" parameterType="String">
- delete from chat_msg where msg_id in
- <foreach item="msgId" collection="array" open="(" separator="," close=")">
- #{msgId}
- </foreach>
- </delete>
- </mapper>
|