FastGptRoleMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.FastGptRoleMapper">
  6. <resultMap type="FastGptRole" id="FastGptRoleResult">
  7. <result property="roleId" column="role_id" />
  8. <result property="roleName" column="role_name" />
  9. <result property="companyId" column="company_id" />
  10. <result property="createTime" column="create_time" />
  11. <result property="updateTime" column="update_time" />
  12. <result property="roleType" column="role_type" />
  13. <result property="modeConfigJson" column="mode_config_json" />
  14. <result property="mode" column="mode" />
  15. <result property="kfId" column="kf_id" />
  16. <result property="kfUrl" column="kf_url" />
  17. <result property="avatar" column="avatar" />
  18. <result property="kfMediaId" column="kf_media_id" />
  19. <result property="reminderWords" column="reminder_words" />
  20. <result property="bindCorpId" column="bind_corp_id" />
  21. <result property="contactInfo" column="contact_info" />
  22. <result property="channelType" column="channel_type" />
  23. </resultMap>
  24. <sql id="selectFastGptRoleVo">
  25. select role_id, role_name,contact_info,company_id, create_time, update_time, role_type, mode_config_json, mode, kf_id, kf_url, avatar, kf_media_id,reminder_words, bind_corp_id,channel_type from fastgpt_role
  26. </sql>
  27. <select id="selectFastGptRoleList" parameterType="FastGptRole" resultMap="FastGptRoleResult">
  28. <include refid="selectFastGptRoleVo"/>
  29. <where>
  30. <if test="roleName != null and roleName != ''"> and role_name like concat('%', #{roleName}, '%')</if>
  31. <if test="companyId != null "> and company_id = #{companyId}</if>
  32. <if test="roleType != null "> and role_type = #{roleType}</if>
  33. <if test="modeConfigJson != null and modeConfigJson != ''"> and mode_config_json = #{modeConfigJson}</if>
  34. <if test="mode != null "> and mode = #{mode}</if>
  35. <if test="kfId != null and kfId != ''"> and kf_id = #{kfId}</if>
  36. <if test="kfUrl != null and kfUrl != ''"> and kf_url = #{kfUrl}</if>
  37. <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
  38. <if test="kfMediaId != null and kfMediaId != ''"> and kf_media_id = #{kfMediaId}</if>
  39. <if test="reminderWords != null and reminderWords != ''"> and reminder_words = #{reminderWords}</if>
  40. <if test="bindCorpId != null and bindCorpId != ''"> and bind_corp_id = #{bindCorpId}</if>
  41. </where>
  42. </select>
  43. <select id="selectFastGptRoleByRoleId" parameterType="Long" resultMap="FastGptRoleResult">
  44. <include refid="selectFastGptRoleVo"/>
  45. where role_id = #{roleId}
  46. </select>
  47. <select id="selectFastGptRoleByRoleIds" resultType="com.fs.fastGpt.domain.FastGptRole">
  48. select role_id roleId,role_name roleName from fastgpt_role
  49. <where>
  50. <if test="roleIds != null">
  51. role_id in
  52. <foreach collection="roleIds" item="roleId" separator="," open="(" close=")">
  53. #{roleId}
  54. </foreach>
  55. </if>
  56. </where>
  57. </select>
  58. <select id="selectFastGptRoleRoleIdsByAppKey" resultType="java.lang.String">
  59. select
  60. role_id as roleId
  61. from fastgpt_role
  62. where mode_config_json like concat('{"APPKey":"', #{appKey}, '%')
  63. </select>
  64. <select id="selectFastGptRoleAppKeyList" resultType="com.fs.fastGpt.vo.FastgptEventLogTotalVo">
  65. select
  66. role_id as roleId,role_name as roleName,mode_config_json as appKey
  67. from fastgpt_role
  68. </select>
  69. <insert id="insertFastGptRole" parameterType="FastGptRole" useGeneratedKeys="true" keyProperty="roleId">
  70. insert into fastgpt_role
  71. <trim prefix="(" suffix=")" suffixOverrides=",">
  72. <if test="roleName != null">role_name,</if>
  73. <if test="companyId != null">company_id,</if>
  74. <if test="createTime != null">create_time,</if>
  75. <if test="updateTime != null">update_time,</if>
  76. <if test="roleType != null">role_type,</if>
  77. <if test="modeConfigJson != null">mode_config_json,</if>
  78. <if test="mode != null">mode,</if>
  79. <if test="kfId != null">kf_id,</if>
  80. <if test="kfUrl != null">kf_url,</if>
  81. <if test="avatar != null">avatar,</if>
  82. <if test="kfMediaId != null">kf_media_id,</if>
  83. <if test="reminderWords != null">reminder_words,</if>
  84. <if test="bindCorpId != null">bind_corp_id,</if>
  85. <if test="contactInfo != null">contact_info,</if>
  86. <if test="channelType != null">channel_type,</if>
  87. </trim>
  88. <trim prefix="values (" suffix=")" suffixOverrides=",">
  89. <if test="roleName != null">#{roleName},</if>
  90. <if test="companyId != null">#{companyId},</if>
  91. <if test="createTime != null">#{createTime},</if>
  92. <if test="updateTime != null">#{updateTime},</if>
  93. <if test="roleType != null">#{roleType},</if>
  94. <if test="modeConfigJson != null">#{modeConfigJson},</if>
  95. <if test="mode != null">#{mode},</if>
  96. <if test="kfId != null">#{kfId},</if>
  97. <if test="kfUrl != null">#{kfUrl},</if>
  98. <if test="avatar != null">#{avatar},</if>
  99. <if test="kfMediaId != null">#{kfMediaId},</if>
  100. <if test="reminderWords != null">#{reminderWords},</if>
  101. <if test="bindCorpId != null">#{bindCorpId},</if>
  102. <if test="contactInfo != null">#{contactInfo},</if>
  103. <if test="channelType != null">#{channelType},</if>
  104. </trim>
  105. </insert>
  106. <update id="updateFastGptRole" parameterType="FastGptRole">
  107. update fastgpt_role
  108. <trim prefix="SET" suffixOverrides=",">
  109. <if test="roleName != null">role_name = #{roleName},</if>
  110. <if test="companyId != null">company_id = #{companyId},</if>
  111. <if test="createTime != null">create_time = #{createTime},</if>
  112. <if test="updateTime != null">update_time = #{updateTime},</if>
  113. <if test="roleType != null">role_type = #{roleType},</if>
  114. <if test="modeConfigJson != null">mode_config_json = #{modeConfigJson},</if>
  115. <if test="mode != null">mode = #{mode},</if>
  116. <if test="kfId != null">kf_id = #{kfId},</if>
  117. <if test="kfUrl != null">kf_url = #{kfUrl},</if>
  118. <if test="avatar != null">avatar = #{avatar},</if>
  119. <if test="kfMediaId != null">kf_media_id = #{kfMediaId},</if>
  120. <if test="reminderWords != null">reminder_words = #{reminderWords},</if>
  121. <if test="bindCorpId != null">bind_corp_id = #{bindCorpId},</if>
  122. <if test="contactInfo != null">contact_info = #{contactInfo},</if>
  123. <if test="channelType != null">channel_type = #{channelType},</if>
  124. </trim>
  125. where role_id = #{roleId}
  126. </update>
  127. <delete id="deleteFastGptRoleByRoleId" parameterType="Long">
  128. delete from fastgpt_role where role_id = #{roleId}
  129. </delete>
  130. <delete id="deleteFastGptRoleByRoleIds" parameterType="String">
  131. delete from fastgpt_role where role_id in
  132. <foreach item="roleId" collection="array" open="(" separator="," close=")">
  133. #{roleId}
  134. </foreach>
  135. </delete>
  136. </mapper>