ChatRoleMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.chat.mapper.ChatRoleMapper">
  6. <resultMap type="ChatRole" id="ChatRoleResult">
  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="configJson" column="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="kfMediaId" column="kf_media_id" />
  18. <result property="avatar" column="avatar" />
  19. <result property="modeConfigJson" column="mode_config_json" />
  20. </resultMap>
  21. <sql id="selectChatRoleVo">
  22. select role_id, role_name,avatar, company_id, create_time, update_time, role_type, config_json, mode, kf_id, kf_url,kf_media_id, mode_config_json from chat_role
  23. </sql>
  24. <select id="selectChatRoleList" parameterType="ChatRole" resultMap="ChatRoleResult">
  25. <include refid="selectChatRoleVo"/>
  26. <where>
  27. <if test="roleName != null and roleName != ''"> and role_name like concat('%', #{roleName}, '%')</if>
  28. <if test="companyId != null "> and company_id = #{companyId}</if>
  29. <if test="roleType != null "> and role_type = #{roleType}</if>
  30. <if test="configJson != null and configJson != ''"> and config_json = #{configJson}</if>
  31. <if test="mode != null "> and mode = #{mode}</if>
  32. <if test="kfId != null and kfId != ''"> and kf_id = #{kfId}</if>
  33. <if test="kfUrl != null and kfUrl != ''"> and kf_url = #{kfUrl}</if>
  34. <if test="modeConfigJson != null and modeConfigJson != ''"> and mode_config_json = #{modeConfigJson}</if>
  35. </where>
  36. </select>
  37. <select id="selectChatRoleByRoleId" parameterType="Long" resultMap="ChatRoleResult">
  38. <include refid="selectChatRoleVo"/>
  39. where role_id = #{roleId}
  40. </select>
  41. <insert id="insertChatRole" parameterType="ChatRole" useGeneratedKeys="true" keyProperty="roleId">
  42. insert into chat_role
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="roleName != null">role_name,</if>
  45. <if test="companyId != null">company_id,</if>
  46. <if test="createTime != null">create_time,</if>
  47. <if test="updateTime != null">update_time,</if>
  48. <if test="roleType != null">role_type,</if>
  49. <if test="configJson != null">config_json,</if>
  50. <if test="mode != null">mode,</if>
  51. <if test="kfId != null">kf_id,</if>
  52. <if test="kfUrl != null">kf_url,</if>
  53. <if test="kfMediaId != null">kf_media_id,</if>
  54. <if test="modeConfigJson != null">mode_config_json,</if>
  55. <if test="avatar != null">avatar,</if>
  56. </trim>
  57. <trim prefix="values (" suffix=")" suffixOverrides=",">
  58. <if test="roleName != null">#{roleName},</if>
  59. <if test="companyId != null">#{companyId},</if>
  60. <if test="createTime != null">#{createTime},</if>
  61. <if test="updateTime != null">#{updateTime},</if>
  62. <if test="roleType != null">#{roleType},</if>
  63. <if test="configJson != null">#{configJson},</if>
  64. <if test="mode != null">#{mode},</if>
  65. <if test="kfId != null">#{kfId},</if>
  66. <if test="kfUrl != null">#{kfUrl},</if>
  67. <if test="kfMediaId != null">#{kfMediaId},</if>
  68. <if test="modeConfigJson != null">#{modeConfigJson},</if>
  69. <if test="avatar != null">#{avatar},</if>
  70. </trim>
  71. </insert>
  72. <update id="updateChatRole" parameterType="ChatRole">
  73. update chat_role
  74. <trim prefix="SET" suffixOverrides=",">
  75. <if test="roleName != null">role_name = #{roleName},</if>
  76. <if test="companyId != null">company_id = #{companyId},</if>
  77. <if test="createTime != null">create_time = #{createTime},</if>
  78. <if test="updateTime != null">update_time = #{updateTime},</if>
  79. <if test="roleType != null">role_type = #{roleType},</if>
  80. <if test="configJson != null">config_json = #{configJson},</if>
  81. <if test="mode != null">mode = #{mode},</if>
  82. <if test="kfId != null">kf_id = #{kfId},</if>
  83. <if test="kfUrl != null">kf_url = #{kfUrl},</if>
  84. <if test="kfMediaId != null">kf_media_id = #{kfMediaId},</if>
  85. <if test="modeConfigJson != null">mode_config_json = #{modeConfigJson},</if>
  86. <if test="avatar != null">avatar = #{avatar},</if>
  87. </trim>
  88. where role_id = #{roleId}
  89. </update>
  90. <delete id="deleteChatRoleByRoleId" parameterType="Long">
  91. delete from chat_role where role_id = #{roleId}
  92. </delete>
  93. <delete id="deleteChatRoleByRoleIds" parameterType="String">
  94. delete from chat_role where role_id in
  95. <foreach item="roleId" collection="array" open="(" separator="," close=")">
  96. #{roleId}
  97. </foreach>
  98. </delete>
  99. </mapper>