QwMessagesMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.QwMessagesMapper">
  6. <resultMap type="QwMessages" id="QwMessagesResult">
  7. <result property="id" column="id" />
  8. <result property="msgid" column="msgid" />
  9. <result property="action" column="action" />
  10. <result property="from" column="from" />
  11. <result property="tolist" column="tolist" />
  12. <result property="roomid" column="roomid" />
  13. <result property="msgtime" column="msgtime" />
  14. <result property="msgtype" column="msgtype" />
  15. <result property="content" column="content" />
  16. <result property="createdAt" column="created_at" />
  17. <result property="updatedAt" column="updated_at" />
  18. </resultMap>
  19. <sql id="selectQwMessagesVo">
  20. select id, msgid, action, from, tolist, roomid, msgtime, msgtype, content, created_at, updated_at from qw_messages
  21. </sql>
  22. <select id="selectQwMessagesList" parameterType="QwMessages" resultMap="QwMessagesResult">
  23. <include refid="selectQwMessagesVo"/>
  24. <where>
  25. <if test="msgid != null and msgid != ''"> and msgid = #{msgid}</if>
  26. <if test="action != null and action != ''"> and action = #{action}</if>
  27. <if test="from != null and from != ''"> and from = #{from}</if>
  28. <if test="tolist != null and tolist != ''"> and tolist = #{tolist}</if>
  29. <if test="roomid != null and roomid != ''"> and roomid = #{roomid}</if>
  30. <if test="msgtime != null "> and msgtime = #{msgtime}</if>
  31. <if test="msgtype != null and msgtype != ''"> and msgtype = #{msgtype}</if>
  32. <if test="content != null and content != ''"> and content = #{content}</if>
  33. <if test="createdAt != null "> and created_at = #{createdAt}</if>
  34. <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
  35. </where>
  36. </select>
  37. <select id="selectQwMessagesById" parameterType="Long" resultMap="QwMessagesResult">
  38. <include refid="selectQwMessagesVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertQwMessages" parameterType="QwMessages" useGeneratedKeys="true" keyProperty="id">
  42. insert into qw_messages
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="msgid != null and msgid != ''">msgid,</if>
  45. <if test="action != null and action != ''">action,</if>
  46. <if test="from != null and from != ''">from,</if>
  47. <if test="tolist != null and tolist != ''">tolist,</if>
  48. <if test="roomid != null">roomid,</if>
  49. <if test="msgtime != null">msgtime,</if>
  50. <if test="msgtype != null and msgtype != ''">msgtype,</if>
  51. <if test="content != null and content != ''">content,</if>
  52. <if test="createdAt != null">created_at,</if>
  53. <if test="updatedAt != null">updated_at,</if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="msgid != null and msgid != ''">#{msgid},</if>
  57. <if test="action != null and action != ''">#{action},</if>
  58. <if test="from != null and from != ''">#{from},</if>
  59. <if test="tolist != null and tolist != ''">#{tolist},</if>
  60. <if test="roomid != null">#{roomid},</if>
  61. <if test="msgtime != null">#{msgtime},</if>
  62. <if test="msgtype != null and msgtype != ''">#{msgtype},</if>
  63. <if test="content != null and content != ''">#{content},</if>
  64. <if test="createdAt != null">#{createdAt},</if>
  65. <if test="updatedAt != null">#{updatedAt},</if>
  66. </trim>
  67. </insert>
  68. <insert id="batchInsertQwMessages" parameterType="java.util.List">
  69. insert into qw_messages
  70. (msgid, action, `from`, tolist, roomid, msgtime, msgtype, content, created_at, updated_at)
  71. values
  72. <foreach collection="list" item="item" separator=",">
  73. (
  74. #{item.msgid},
  75. #{item.action},
  76. #{item.from},
  77. #{item.tolist},
  78. #{item.roomid},
  79. #{item.msgtime},
  80. #{item.msgtype},
  81. #{item.content},
  82. #{item.createdAt},
  83. #{item.updatedAt}
  84. )
  85. </foreach>
  86. </insert>
  87. <update id="updateQwMessages" parameterType="QwMessages">
  88. update qw_messages
  89. <trim prefix="SET" suffixOverrides=",">
  90. <if test="msgid != null and msgid != ''">msgid = #{msgid},</if>
  91. <if test="action != null and action != ''">action = #{action},</if>
  92. <if test="from != null and from != ''">from = #{from},</if>
  93. <if test="tolist != null and tolist != ''">tolist = #{tolist},</if>
  94. <if test="roomid != null">roomid = #{roomid},</if>
  95. <if test="msgtime != null">msgtime = #{msgtime},</if>
  96. <if test="msgtype != null and msgtype != ''">msgtype = #{msgtype},</if>
  97. <if test="content != null and content != ''">content = #{content},</if>
  98. <if test="createdAt != null">created_at = #{createdAt},</if>
  99. <if test="updatedAt != null">updated_at = #{updatedAt},</if>
  100. </trim>
  101. where id = #{id}
  102. </update>
  103. <delete id="deleteQwMessagesById" parameterType="Long">
  104. delete from qw_messages where id = #{id}
  105. </delete>
  106. <delete id="deleteQwMessagesByIds" parameterType="String">
  107. delete from qw_messages where id in
  108. <foreach item="id" collection="array" open="(" separator="," close=")">
  109. #{id}
  110. </foreach>
  111. </delete>
  112. </mapper>