QwMsgMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.qw.mapper.QwMsgMapper">
  6. <resultMap type="QwMsg" id="QwMsgResult">
  7. <result property="msgId" column="msg_id" />
  8. <result property="sessionId" column="session_id" />
  9. <result property="qwExtId" column="qw_ext_id" />
  10. <result property="qwUserId" column="qw_user_id" />
  11. <result property="content" column="content" />
  12. <result property="msgType" column="msg_type" />
  13. <result property="sendType" column="send_type" />
  14. <result property="companyId" column="company_id" />
  15. <result property="roleId" column="role_id" />
  16. <result property="companyUserId" column="company_user_id" />
  17. <result property="createTime" column="create_time" />
  18. <result property="msgJson" column="msg_json" />
  19. <result property="status" column="status" />
  20. <result property="nickName" column="nick_name" />
  21. <result property="avatar" column="avatar" />
  22. </resultMap>
  23. <sql id="selectQwMsgVo">
  24. select msg_id, session_id, qw_ext_id, qw_user_id, content, msg_type, send_type, company_id, role_id, company_user_id, create_time, msg_json, status, nick_name, avatar from qw_msg
  25. </sql>
  26. <select id="selectQwMsgList" parameterType="QwMsg" resultMap="QwMsgResult">
  27. <include refid="selectQwMsgVo"/>
  28. <where>
  29. <if test="sessionId != null "> and session_id = #{sessionId}</if>
  30. <if test="qwExtId != null and qwExtId != ''"> and qw_ext_id = #{qwExtId}</if>
  31. <if test="qwUserId != null and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
  32. <if test="content != null and content != ''"> and content = #{content}</if>
  33. <if test="msgType != null "> and msg_type = #{msgType}</if>
  34. <if test="sendType != null "> and send_type = #{sendType}</if>
  35. <if test="companyId != null "> and company_id = #{companyId}</if>
  36. <if test="roleId != null "> and role_id = #{roleId}</if>
  37. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  38. <if test="msgJson != null and msgJson != ''"> and msg_json = #{msgJson}</if>
  39. <if test="status != null "> and status = #{status}</if>
  40. <if test="nickName != null and nickName != ''"> and nick_name like concat( #{nickName}, '%')</if>
  41. <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
  42. </where>
  43. </select>
  44. <select id="selectQwMsgByMsgId" parameterType="Long" resultMap="QwMsgResult">
  45. <include refid="selectQwMsgVo"/>
  46. where msg_id = #{msgId}
  47. </select>
  48. <insert id="insertQwMsg" parameterType="QwMsg" useGeneratedKeys="true" keyProperty="msgId">
  49. insert into qw_msg
  50. <trim prefix="(" suffix=")" suffixOverrides=",">
  51. <if test="sessionId != null">session_id,</if>
  52. <if test="qwExtId != null">qw_ext_id,</if>
  53. <if test="qwUserId != null">qw_user_id,</if>
  54. <if test="content != null">content,</if>
  55. <if test="msgType != null">msg_type,</if>
  56. <if test="sendType != null">send_type,</if>
  57. <if test="companyId != null">company_id,</if>
  58. <if test="roleId != null">role_id,</if>
  59. <if test="companyUserId != null">company_user_id,</if>
  60. <if test="createTime != null">create_time,</if>
  61. <if test="msgJson != null">msg_json,</if>
  62. <if test="status != null">status,</if>
  63. <if test="nickName != null">nick_name,</if>
  64. <if test="avatar != null">avatar,</if>
  65. </trim>
  66. <trim prefix="values (" suffix=")" suffixOverrides=",">
  67. <if test="sessionId != null">#{sessionId},</if>
  68. <if test="qwExtId != null">#{qwExtId},</if>
  69. <if test="qwUserId != null">#{qwUserId},</if>
  70. <if test="content != null">#{content},</if>
  71. <if test="msgType != null">#{msgType},</if>
  72. <if test="sendType != null">#{sendType},</if>
  73. <if test="companyId != null">#{companyId},</if>
  74. <if test="roleId != null">#{roleId},</if>
  75. <if test="companyUserId != null">#{companyUserId},</if>
  76. <if test="createTime != null">#{createTime},</if>
  77. <if test="msgJson != null">#{msgJson},</if>
  78. <if test="status != null">#{status},</if>
  79. <if test="nickName != null">#{nickName},</if>
  80. <if test="avatar != null">#{avatar},</if>
  81. </trim>
  82. </insert>
  83. <update id="updateQwMsg" parameterType="QwMsg">
  84. update qw_msg
  85. <trim prefix="SET" suffixOverrides=",">
  86. <if test="sessionId != null">session_id = #{sessionId},</if>
  87. <if test="qwExtId != null">qw_ext_id = #{qwExtId},</if>
  88. <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
  89. <if test="content != null">content = #{content},</if>
  90. <if test="msgType != null">msg_type = #{msgType},</if>
  91. <if test="sendType != null">send_type = #{sendType},</if>
  92. <if test="companyId != null">company_id = #{companyId},</if>
  93. <if test="roleId != null">role_id = #{roleId},</if>
  94. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  95. <if test="createTime != null">create_time = #{createTime},</if>
  96. <if test="msgJson != null">msg_json = #{msgJson},</if>
  97. <if test="status != null">status = #{status},</if>
  98. <if test="nickName != null">nick_name = #{nickName},</if>
  99. <if test="avatar != null">avatar = #{avatar},</if>
  100. </trim>
  101. where msg_id = #{msgId}
  102. </update>
  103. <delete id="deleteQwMsgByMsgId" parameterType="Long">
  104. delete from qw_msg where msg_id = #{msgId}
  105. </delete>
  106. <delete id="deleteQwMsgByMsgIds" parameterType="String">
  107. delete from qw_msg where msg_id in
  108. <foreach item="msgId" collection="array" open="(" separator="," close=")">
  109. #{msgId}
  110. </foreach>
  111. </delete>
  112. </mapper>