ChatMsgLogsMapper.xml 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.ChatMsgLogsMapper">
  6. <resultMap type="ChatMsgLogs" id="ChatMsgLogsResult">
  7. <result property="logsId" column="logs_id" />
  8. <result property="msgId" column="msg_id" />
  9. <result property="logsType" column="logs_type" />
  10. <result property="content" column="content" />
  11. <result property="sContent" column="s_content" />
  12. <result property="userContent" column="user_content" />
  13. <result property="companyUserId" column="company_user_id" />
  14. <result property="createTime" column="create_time" />
  15. <result property="createBy" column="create_by" />
  16. <result property="companyId" column="company_id" />
  17. </resultMap>
  18. <sql id="selectChatMsgLogsVo">
  19. select logs_id, msg_id, logs_type, company_id,content,s_content,user_content, company_user_id, create_time,create_by from chat_msg_logs
  20. </sql>
  21. <select id="selectChatMsgLogsList" parameterType="ChatMsgLogs" resultMap="ChatMsgLogsResult">
  22. <include refid="selectChatMsgLogsVo"/>
  23. <where>
  24. <if test="msgId != null "> and msg_id = #{msgId}</if>
  25. <if test="logsType != null "> and logs_type = #{logsType}</if>
  26. <if test="content != null and content != ''"> and content = #{content}</if>
  27. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  28. <if test="companyId != null "> and company_id = #{companyId}</if>
  29. </where>
  30. </select>
  31. <select id="selectChatMsgLogsByLogsId" parameterType="Long" resultMap="ChatMsgLogsResult">
  32. <include refid="selectChatMsgLogsVo"/>
  33. where logs_id = #{logsId}
  34. </select>
  35. <insert id="insertChatMsgLogs" parameterType="ChatMsgLogs" useGeneratedKeys="true" keyProperty="logsId">
  36. insert into chat_msg_logs
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="msgId != null">msg_id,</if>
  39. <if test="logsType != null">logs_type,</if>
  40. <if test="content != null">content,</if>
  41. <if test="sContent != null">s_content,</if>
  42. <if test="userContent != null">user_content,</if>
  43. <if test="companyUserId != null">company_user_id,</if>
  44. <if test="createTime != null">create_time,</if>
  45. <if test="createBy != null">create_by,</if>
  46. <if test="companyId != null">company_id,</if>
  47. </trim>
  48. <trim prefix="values (" suffix=")" suffixOverrides=",">
  49. <if test="msgId != null">#{msgId},</if>
  50. <if test="logsType != null">#{logsType},</if>
  51. <if test="content != null">#{content},</if>
  52. <if test="sContent != null">#{sContent},</if>
  53. <if test="userContent != null">#{userContent},</if>
  54. <if test="companyUserId != null">#{companyUserId},</if>
  55. <if test="createTime != null">#{createTime},</if>
  56. <if test="createBy != null">#{createBy},</if>
  57. <if test="companyId != null">#{companyId},</if>
  58. </trim>
  59. </insert>
  60. <update id="updateChatMsgLogs" parameterType="ChatMsgLogs">
  61. update chat_msg_logs
  62. <trim prefix="SET" suffixOverrides=",">
  63. <if test="msgId != null">msg_id = #{msgId},</if>
  64. <if test="logsType != null">logs_type = #{logsType},</if>
  65. <if test="content != null">content = #{content},</if>
  66. <if test="sContent != null">s_content = #{sContent},</if>
  67. <if test="userContent != null">user_content = #{userContent},</if>
  68. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  69. <if test="createTime != null">create_time = #{createTime},</if>
  70. <if test="createBy != null">create_by = #{createBy},</if>
  71. <if test="companyId != null">company_id = #{companyId},</if>
  72. </trim>
  73. where logs_id = #{logsId}
  74. </update>
  75. <delete id="deleteChatMsgLogsByLogsId" parameterType="Long">
  76. delete from chat_msg_logs where logs_id = #{logsId}
  77. </delete>
  78. <delete id="deleteChatMsgLogsByLogsIds" parameterType="String">
  79. delete from chat_msg_logs where logs_id in
  80. <foreach item="logsId" collection="array" open="(" separator="," close=")">
  81. #{logsId}
  82. </foreach>
  83. </delete>
  84. </mapper>