HistoryMessageMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tzld.piaoquan.wecom.dao.mapper.HistoryMessageMapper">
  4. <resultMap id="BaseResultMap" type="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="user_id" jdbcType="BIGINT" property="userId" />
  7. <result column="staff_id" jdbcType="BIGINT" property="staffId" />
  8. <result column="video_id" jdbcType="BIGINT" property="videoId" />
  9. <result column="attachment_idx" jdbcType="INTEGER" property="attachmentIdx" />
  10. <result column="message_id" jdbcType="BIGINT" property="messageId" />
  11. <result column="status" jdbcType="INTEGER" property="status" />
  12. <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
  13. <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
  14. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  15. </resultMap>
  16. <sql id="Example_Where_Clause">
  17. <where>
  18. <foreach collection="oredCriteria" item="criteria" separator="or">
  19. <if test="criteria.valid">
  20. <trim prefix="(" prefixOverrides="and" suffix=")">
  21. <foreach collection="criteria.criteria" item="criterion">
  22. <choose>
  23. <when test="criterion.noValue">
  24. and ${criterion.condition}
  25. </when>
  26. <when test="criterion.singleValue">
  27. and ${criterion.condition} #{criterion.value}
  28. </when>
  29. <when test="criterion.betweenValue">
  30. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  31. </when>
  32. <when test="criterion.listValue">
  33. and ${criterion.condition}
  34. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  35. #{listItem}
  36. </foreach>
  37. </when>
  38. </choose>
  39. </foreach>
  40. </trim>
  41. </if>
  42. </foreach>
  43. </where>
  44. </sql>
  45. <sql id="Update_By_Example_Where_Clause">
  46. <where>
  47. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  48. <if test="criteria.valid">
  49. <trim prefix="(" prefixOverrides="and" suffix=")">
  50. <foreach collection="criteria.criteria" item="criterion">
  51. <choose>
  52. <when test="criterion.noValue">
  53. and ${criterion.condition}
  54. </when>
  55. <when test="criterion.singleValue">
  56. and ${criterion.condition} #{criterion.value}
  57. </when>
  58. <when test="criterion.betweenValue">
  59. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  60. </when>
  61. <when test="criterion.listValue">
  62. and ${criterion.condition}
  63. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  64. #{listItem}
  65. </foreach>
  66. </when>
  67. </choose>
  68. </foreach>
  69. </trim>
  70. </if>
  71. </foreach>
  72. </where>
  73. </sql>
  74. <sql id="Base_Column_List">
  75. id, user_id, staff_id, video_id, attachment_idx, message_id, `status`, send_time,
  76. is_delete, create_time
  77. </sql>
  78. <select id="selectByExample" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessageExample" resultMap="BaseResultMap">
  79. select
  80. <if test="distinct">
  81. distinct
  82. </if>
  83. <include refid="Base_Column_List" />
  84. from we_com_history_message
  85. <if test="_parameter != null">
  86. <include refid="Example_Where_Clause" />
  87. </if>
  88. <if test="orderByClause != null">
  89. order by ${orderByClause}
  90. </if>
  91. <if test="page != null">
  92. limit #{page.offset} , #{page.pageSize}
  93. </if>
  94. </select>
  95. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  96. select
  97. <include refid="Base_Column_List" />
  98. from we_com_history_message
  99. where id = #{id,jdbcType=BIGINT}
  100. </select>
  101. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  102. delete from we_com_history_message
  103. where id = #{id,jdbcType=BIGINT}
  104. </delete>
  105. <delete id="deleteByExample" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessageExample">
  106. delete from we_com_history_message
  107. <if test="_parameter != null">
  108. <include refid="Example_Where_Clause" />
  109. </if>
  110. </delete>
  111. <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
  112. insert into we_com_history_message (id, user_id, staff_id,
  113. video_id, attachment_idx, message_id,
  114. `status`, send_time,
  115. create_time)
  116. values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{staffId,jdbcType=BIGINT},
  117. #{videoId,jdbcType=BIGINT}, #{attachmentIdx,jdbcType=INTEGER}, #{messageId,jdbcType=BIGINT},
  118. #{status,jdbcType=INTEGER}, #{sendTime,jdbcType=TIMESTAMP},
  119. #{createTime,jdbcType=TIMESTAMP})
  120. </insert>
  121. <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
  122. insert into we_com_history_message
  123. <trim prefix="(" suffix=")" suffixOverrides=",">
  124. <if test="id != null">
  125. id,
  126. </if>
  127. <if test="userId != null">
  128. user_id,
  129. </if>
  130. <if test="staffId != null">
  131. staff_id,
  132. </if>
  133. <if test="videoId != null">
  134. video_id,
  135. </if>
  136. <if test="attachmentIdx != null">
  137. attachment_idx,
  138. </if>
  139. <if test="messageId != null">
  140. message_id,
  141. </if>
  142. <if test="status != null">
  143. `status`,
  144. </if>
  145. <if test="sendTime != null">
  146. send_time,
  147. </if>
  148. <if test="isDelete != null">
  149. is_delete,
  150. </if>
  151. <if test="createTime != null">
  152. create_time,
  153. </if>
  154. </trim>
  155. <trim prefix="values (" suffix=")" suffixOverrides=",">
  156. <if test="id != null">
  157. #{id,jdbcType=BIGINT},
  158. </if>
  159. <if test="userId != null">
  160. #{userId,jdbcType=BIGINT},
  161. </if>
  162. <if test="staffId != null">
  163. #{staffId,jdbcType=BIGINT},
  164. </if>
  165. <if test="videoId != null">
  166. #{videoId,jdbcType=BIGINT},
  167. </if>
  168. <if test="attachmentIdx != null">
  169. #{attachmentIdx,jdbcType=INTEGER},
  170. </if>
  171. <if test="messageId != null">
  172. #{messageId,jdbcType=BIGINT},
  173. </if>
  174. <if test="status != null">
  175. #{status,jdbcType=INTEGER},
  176. </if>
  177. <if test="sendTime != null">
  178. #{sendTime,jdbcType=TIMESTAMP},
  179. </if>
  180. <if test="isDelete != null">
  181. #{isDelete,jdbcType=INTEGER},
  182. </if>
  183. <if test="createTime != null">
  184. #{createTime,jdbcType=TIMESTAMP},
  185. </if>
  186. </trim>
  187. </insert>
  188. <select id="countByExample" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessageExample" resultType="java.lang.Long">
  189. select count(*) from we_com_history_message
  190. <if test="_parameter != null">
  191. <include refid="Example_Where_Clause" />
  192. </if>
  193. </select>
  194. <update id="updateByExampleSelective" parameterType="map">
  195. update we_com_history_message
  196. <set>
  197. <if test="record.id != null">
  198. id = #{record.id,jdbcType=BIGINT},
  199. </if>
  200. <if test="record.userId != null">
  201. user_id = #{record.userId,jdbcType=BIGINT},
  202. </if>
  203. <if test="record.staffId != null">
  204. staff_id = #{record.staffId,jdbcType=BIGINT},
  205. </if>
  206. <if test="record.videoId != null">
  207. video_id = #{record.videoId,jdbcType=BIGINT},
  208. </if>
  209. <if test="record.attachmentIdx != null">
  210. attachment_idx = #{record.attachmentIdx,jdbcType=INTEGER},
  211. </if>
  212. <if test="record.messageId != null">
  213. message_id = #{record.messageId,jdbcType=BIGINT},
  214. </if>
  215. <if test="record.status != null">
  216. `status` = #{record.status,jdbcType=INTEGER},
  217. </if>
  218. <if test="record.sendTime != null">
  219. send_time = #{record.sendTime,jdbcType=TIMESTAMP},
  220. </if>
  221. <if test="record.isDelete != null">
  222. is_delete = #{record.isDelete,jdbcType=INTEGER},
  223. </if>
  224. <if test="record.createTime != null">
  225. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  226. </if>
  227. </set>
  228. <if test="_parameter != null">
  229. <include refid="Update_By_Example_Where_Clause" />
  230. </if>
  231. </update>
  232. <update id="updateByExample" parameterType="map">
  233. update we_com_history_message
  234. set id = #{record.id,jdbcType=BIGINT},
  235. user_id = #{record.userId,jdbcType=BIGINT},
  236. staff_id = #{record.staffId,jdbcType=BIGINT},
  237. video_id = #{record.videoId,jdbcType=BIGINT},
  238. attachment_idx = #{record.attachmentIdx,jdbcType=INTEGER},
  239. message_id = #{record.messageId,jdbcType=BIGINT},
  240. `status` = #{record.status,jdbcType=INTEGER},
  241. send_time = #{record.sendTime,jdbcType=TIMESTAMP},
  242. is_delete = #{record.isDelete,jdbcType=INTEGER},
  243. create_time = #{record.createTime,jdbcType=TIMESTAMP}
  244. <if test="_parameter != null">
  245. <include refid="Update_By_Example_Where_Clause" />
  246. </if>
  247. </update>
  248. <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
  249. update we_com_history_message
  250. <set>
  251. <if test="userId != null">
  252. user_id = #{userId,jdbcType=BIGINT},
  253. </if>
  254. <if test="staffId != null">
  255. staff_id = #{staffId,jdbcType=BIGINT},
  256. </if>
  257. <if test="videoId != null">
  258. video_id = #{videoId,jdbcType=BIGINT},
  259. </if>
  260. <if test="attachmentIdx != null">
  261. attachment_idx = #{attachmentIdx,jdbcType=INTEGER},
  262. </if>
  263. <if test="messageId != null">
  264. message_id = #{messageId,jdbcType=BIGINT},
  265. </if>
  266. <if test="status != null">
  267. `status` = #{status,jdbcType=INTEGER},
  268. </if>
  269. <if test="sendTime != null">
  270. send_time = #{sendTime,jdbcType=TIMESTAMP},
  271. </if>
  272. <if test="isDelete != null">
  273. is_delete = #{isDelete,jdbcType=INTEGER},
  274. </if>
  275. <if test="createTime != null">
  276. create_time = #{createTime,jdbcType=TIMESTAMP},
  277. </if>
  278. </set>
  279. where id = #{id,jdbcType=BIGINT}
  280. </update>
  281. <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.wecom.model.po.HistoryMessage">
  282. update we_com_history_message
  283. set user_id = #{userId,jdbcType=BIGINT},
  284. staff_id = #{staffId,jdbcType=BIGINT},
  285. video_id = #{videoId,jdbcType=BIGINT},
  286. attachment_idx = #{attachmentIdx,jdbcType=INTEGER},
  287. message_id = #{messageId,jdbcType=BIGINT},
  288. `status` = #{status,jdbcType=INTEGER},
  289. send_time = #{sendTime,jdbcType=TIMESTAMP},
  290. is_delete = #{isDelete,jdbcType=INTEGER},
  291. create_time = #{createTime,jdbcType=TIMESTAMP}
  292. where id = #{id,jdbcType=BIGINT}
  293. </update>
  294. <insert id="insertList" parameterType="java.util.List">
  295. insert into we_com_history_message
  296. (
  297. user_id,
  298. staff_id,
  299. video_id,
  300. attachment_idx,
  301. message_id,
  302. `status`,
  303. send_time,
  304. create_time
  305. )
  306. values
  307. <foreach collection="list" item="item" separator=",">
  308. (
  309. #{item.userId,jdbcType=BIGINT},
  310. #{item.staffId,jdbcType=BIGINT},
  311. #{item.videoId,jdbcType=BIGINT},
  312. #{item.attachmentIdx,jdbcType=INTEGER},
  313. #{item.messageId,jdbcType=BIGINT},
  314. #{item.status,jdbcType=INTEGER},
  315. #{item.sendTime,jdbcType=TIMESTAMP},
  316. #{item.createTime,jdbcType=TIMESTAMP}
  317. )
  318. </foreach>
  319. </insert>
  320. </mapper>