123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?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.fastGpt.mapper.FastGptChatMsgMapper">
- <resultMap type="FastGptChatMsg" id="FastGptChatMsgResult">
- <result property="msgId" column="msg_id" />
- <result property="sessionId" column="session_id" />
- <result property="extId" column="ext_id" />
- <result property="userId" column="user_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="status" column="status" />
- <result property="nickName" column="nick_name" />
- <result property="avatar" column="avatar" />
- <result property="userType" column="user_type" />
- <result property="promptTokens" column="prompt_tokens" />
- <result property="completionTokens" column="completion_tokens" />
- <result property="totalTokens" column="total_tokens" />
- </resultMap>
- <sql id="selectFastGptChatMsgVo">
- select msg_id, session_id,prompt_tokens,completion_tokens,total_tokens, ext_id, user_id, content, msg_type, send_type, company_id, role_id, company_user_id, create_time, msg_json, status, nick_name, avatar, user_type from fastgpt_chat_msg
- </sql>
- <select id="selectFastGptChatMsgList" parameterType="FastGptChatMsg" resultMap="FastGptChatMsgResult">
- <include refid="selectFastGptChatMsgVo"/>
- <where>
- <if test="sessionId != null "> and session_id = #{sessionId}</if>
- <if test="extId != null and extId != ''"> and ext_id = #{extId}</if>
- <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
- <if test="content != null and content != ''"> and content = #{content}</if>
- <if test="msgType != null "> and msg_type = #{msgType}</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="status != null "> and status = #{status}</if>
- <if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
- <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
- <if test="userType != null "> and user_type = #{userType}</if>
- </where>
- </select>
- <select id="selectFastGptChatMsgByMsgId" parameterType="Long" resultMap="FastGptChatMsgResult">
- <include refid="selectFastGptChatMsgVo"/>
- where msg_id = #{msgId}
- </select>
- <insert id="insertFastGptChatMsg" parameterType="FastGptChatMsg" useGeneratedKeys="false">
- insert into fastgpt_chat_msg
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="msgId != null">msg_id,</if>
- <if test="sessionId != null">session_id,</if>
- <if test="extId != null">ext_id,</if>
- <if test="userId != null">user_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="status != null">status,</if>
- <if test="nickName != null">nick_name,</if>
- <if test="avatar != null">avatar,</if>
- <if test="userType != null">user_type,</if>
- <if test="promptTokens != null">prompt_tokens,</if>
- <if test="completionTokens != null">completion_tokens,</if>
- <if test="totalTokens != null">total_tokens,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="msgId != null">#{msgId},</if>
- <if test="sessionId != null">#{sessionId},</if>
- <if test="extId != null">#{extId},</if>
- <if test="userId != null">#{userId},</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="status != null">#{status},</if>
- <if test="nickName != null">#{nickName},</if>
- <if test="avatar != null">#{avatar},</if>
- <if test="userType != null">#{userType},</if>
- <if test="promptTokens != null">#{promptTokens},</if>
- <if test="completionTokens != null">#{completionTokens},</if>
- <if test="totalTokens != null">#{totalTokens},</if>
- </trim>
- </insert>
- <update id="updateFastGptChatMsg" parameterType="FastGptChatMsg">
- update fastgpt_chat_msg
- <trim prefix="SET" suffixOverrides=",">
- <if test="sessionId != null">session_id = #{sessionId},</if>
- <if test="extId != null">ext_id = #{extId},</if>
- <if test="userId != null">user_id = #{userId},</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="status != null">status = #{status},</if>
- <if test="nickName != null">nick_name = #{nickName},</if>
- <if test="avatar != null">avatar = #{avatar},</if>
- <if test="userType != null">user_type = #{userType},</if>
- <if test="promptTokens != null">prompt_tokens = #{promptTokens},</if>
- <if test="completionTokens != null">completion_tokens = #{completionTokens},</if>
- <if test="totalTokens != null">total_tokens = #{totalTokens},</if>
- </trim>
- where msg_id = #{msgId}
- </update>
- <delete id="deleteFastGptChatMsgByMsgId" parameterType="Long">
- delete from fastgpt_chat_msg where msg_id = #{msgId}
- </delete>
- <delete id="deleteFastGptChatMsgByMsgIds" parameterType="String">
- delete from fastgpt_chat_msg where msg_id in
- <foreach item="msgId" collection="array" open="(" separator="," close=")">
- #{msgId}
- </foreach>
- </delete>
- </mapper>
|