FastGptChatSessionMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.fastGpt.mapper.FastGptChatSessionMapper">
  6. <resultMap type="FastGptChatSession" id="FastGptChatSessionResult">
  7. <result property="sessionId" column="session_id" />
  8. <result property="chatId" column="chat_id" />
  9. <result property="userId" column="user_id" />
  10. <result property="kfId" column="kf_id" />
  11. <result property="createTime" column="create_time" />
  12. <result property="updateTime" column="update_time" />
  13. <result property="status" column="status" />
  14. <result property="companyId" column="company_id" />
  15. <result property="isLook" column="is_look" />
  16. <result property="userType" column="user_type" />
  17. <result property="nickName" column="nick_name" />
  18. <result property="avatar" column="avatar" />
  19. <result property="isArtificial" column="is_artificial" />
  20. <result property="remindTime" column="remind_time" />
  21. <result property="remindStatus" column="remind_status" />
  22. <result property="remindCount" column="remind_count" />
  23. <result property="qwExtId" column="qw_ext_id" />
  24. <result property="qwUserId" column="qw_user_id" />
  25. <result property="lastTime" column="last_time" />
  26. <result property="isReply" column="is_reply" />
  27. </resultMap>
  28. <sql id="selectFastGptChatSessionVo">
  29. select session_id,remind_time,is_reply,last_time,remind_status,remind_count,qw_ext_id,qw_user_id,chat_id,is_artificial, user_id, kf_id, create_time, update_time, status, company_id, is_look, user_type, nick_name, avatar from fastgpt_chat_session
  30. </sql>
  31. <select id="selectFastGptChatSessionList" parameterType="FastGptChatSession" resultMap="FastGptChatSessionResult">
  32. <include refid="selectFastGptChatSessionVo"/>
  33. <where>
  34. <if test="chatId != null and chatId != ''"> and chat_id = #{chatId}</if>
  35. <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
  36. <if test="kfId != null and kfId != ''"> and kf_id = #{kfId}</if>
  37. <if test="status != null "> and status = #{status}</if>
  38. <if test="companyId != null "> and company_id = #{companyId}</if>
  39. <if test="isLook != null "> and is_look = #{isLook}</if>
  40. <if test="userType != null "> and user_type = #{userType}</if>
  41. <if test="nickName != null and nickName != ''"> and nick_name like concat( #{nickName}, '%')</if>
  42. <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
  43. </where>
  44. </select>
  45. <select id="selectFastGptChatSessionBySessionId" parameterType="Long" resultMap="FastGptChatSessionResult">
  46. <include refid="selectFastGptChatSessionVo"/>
  47. where session_id = #{sessionId}
  48. </select>
  49. <insert id="insertFastGptChatSession" parameterType="FastGptChatSession" useGeneratedKeys="true" keyProperty="sessionId">
  50. insert into fastgpt_chat_session
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="sessionId != null">session_id,</if>
  53. <if test="chatId != null">chat_id,</if>
  54. <if test="userId != null">user_id,</if>
  55. <if test="kfId != null">kf_id,</if>
  56. <if test="createTime != null">create_time,</if>
  57. <if test="updateTime != null">update_time,</if>
  58. <if test="status != null">status,</if>
  59. <if test="companyId != null">company_id,</if>
  60. <if test="isLook != null">is_look,</if>
  61. <if test="userType != null">user_type,</if>
  62. <if test="nickName != null">nick_name,</if>
  63. <if test="avatar != null">avatar,</if>
  64. <if test="isArtificial != null">is_artificial,</if>
  65. <if test="remindTime != null">remind_time,</if>
  66. <if test="remindStatus != null">remind_status,</if>
  67. <if test="remindCount != null">remind_count,</if>
  68. <if test="qwExtId != null">qw_ext_id,</if>
  69. <if test="qwUserId != null">qw_user_id,</if>
  70. <if test="lastTime != null">last_time,</if>
  71. <if test="isReply != null">is_reply,</if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides=",">
  74. <if test="sessionId != null">#{sessionId},</if>
  75. <if test="chatId != null">#{chatId},</if>
  76. <if test="userId != null">#{userId},</if>
  77. <if test="kfId != null">#{kfId},</if>
  78. <if test="createTime != null">#{createTime},</if>
  79. <if test="updateTime != null">#{updateTime},</if>
  80. <if test="status != null">#{status},</if>
  81. <if test="companyId != null">#{companyId},</if>
  82. <if test="isLook != null">#{isLook},</if>
  83. <if test="userType != null">#{userType},</if>
  84. <if test="nickName != null">#{nickName},</if>
  85. <if test="avatar != null">#{avatar},</if>
  86. <if test="isArtificial != null">#{isArtificial},</if>
  87. <if test="remindTime != null">#{remindTime},</if>
  88. <if test="remindStatus != null">#{remindStatus},</if>
  89. <if test="remindCount != null">#{remindCount},</if>
  90. <if test="qwExtId != null">#{qwExtId},</if>
  91. <if test="qwUserId != null">#{qwUserId},</if>
  92. <if test="lastTime != null">#{lastTime},</if>
  93. <if test="isReply != null">#{isReply},</if>
  94. </trim>
  95. </insert>
  96. <update id="updateFastGptChatSession" parameterType="FastGptChatSession">
  97. update fastgpt_chat_session
  98. <trim prefix="SET" suffixOverrides=",">
  99. <if test="chatId != null">chat_id = #{chatId},</if>
  100. <if test="userId != null">user_id = #{userId},</if>
  101. <if test="kfId != null">kf_id = #{kfId},</if>
  102. <if test="createTime != null">create_time = #{createTime},</if>
  103. <if test="updateTime != null">update_time = #{updateTime},</if>
  104. <if test="status != null">status = #{status},</if>
  105. <if test="companyId != null">company_id = #{companyId},</if>
  106. <if test="isLook != null">is_look = #{isLook},</if>
  107. <if test="userType != null">user_type = #{userType},</if>
  108. <if test="nickName != null">nick_name = #{nickName},</if>
  109. <if test="avatar != null">avatar = #{avatar},</if>
  110. <if test="isArtificial != null">is_artificial = #{isArtificial},</if>
  111. <if test="remindTime != null">remind_time = #{remindTime},</if>
  112. <if test="remindStatus != null">remind_status = #{remindStatus},</if>
  113. <if test="remindCount != null">remind_count = #{remindCount},</if>
  114. <if test="qwExtId != null">qw_ext_id = #{qwExtId},</if>
  115. <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
  116. <if test="lastTime != null">last_time = #{lastTime},</if>
  117. <if test="isReply != null">is_reply = #{isReply},</if>
  118. </trim>
  119. where session_id = #{sessionId}
  120. </update>
  121. <delete id="deleteFastGptChatSessionBySessionId" parameterType="Long">
  122. delete from fastgpt_chat_session where session_id = #{sessionId}
  123. </delete>
  124. <delete id="deleteFastGptChatSessionBySessionIds" parameterType="String">
  125. delete from fastgpt_chat_session where session_id in
  126. <foreach item="sessionId" collection="array" open="(" separator="," close=")">
  127. #{sessionId}
  128. </foreach>
  129. </delete>
  130. </mapper>