MessageFromSystemMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  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.goafanti.common.dao.MessageFromSystemMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.MessageFromSystem">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="creater" jdbcType="VARCHAR" property="creater" />
  12. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  13. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="producer_id" jdbcType="VARCHAR" property="producerId" />
  15. <result column="consumer_type" jdbcType="INTEGER" property="consumerType" />
  16. <result column="title" jdbcType="VARCHAR" property="title" />
  17. <result column="body" jdbcType="VARCHAR" property="body" />
  18. <result column="subject" jdbcType="INTEGER" property="subject" />
  19. <result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
  20. <result column="resource_type" jdbcType="INTEGER" property="resourceType" />
  21. <result column="delete_sign" jdbcType="BIT" property="deleteSign" />
  22. </resultMap>
  23. <sql id="Example_Where_Clause">
  24. <!--
  25. WARNING - @mbg.generated
  26. This element is automatically generated by MyBatis Generator, do not modify.
  27. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  28. -->
  29. <where>
  30. <foreach collection="oredCriteria" item="criteria" separator="or">
  31. <if test="criteria.valid">
  32. <trim prefix="(" prefixOverrides="and" suffix=")">
  33. <foreach collection="criteria.criteria" item="criterion">
  34. <choose>
  35. <when test="criterion.noValue">
  36. and ${criterion.condition}
  37. </when>
  38. <when test="criterion.singleValue">
  39. and ${criterion.condition} #{criterion.value}
  40. </when>
  41. <when test="criterion.betweenValue">
  42. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  43. </when>
  44. <when test="criterion.listValue">
  45. and ${criterion.condition}
  46. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  47. #{listItem}
  48. </foreach>
  49. </when>
  50. </choose>
  51. </foreach>
  52. </trim>
  53. </if>
  54. </foreach>
  55. </where>
  56. </sql>
  57. <sql id="Update_By_Example_Where_Clause">
  58. <!--
  59. WARNING - @mbg.generated
  60. This element is automatically generated by MyBatis Generator, do not modify.
  61. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  62. -->
  63. <where>
  64. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  65. <if test="criteria.valid">
  66. <trim prefix="(" prefixOverrides="and" suffix=")">
  67. <foreach collection="criteria.criteria" item="criterion">
  68. <choose>
  69. <when test="criterion.noValue">
  70. and ${criterion.condition}
  71. </when>
  72. <when test="criterion.singleValue">
  73. and ${criterion.condition} #{criterion.value}
  74. </when>
  75. <when test="criterion.betweenValue">
  76. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  77. </when>
  78. <when test="criterion.listValue">
  79. and ${criterion.condition}
  80. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  81. #{listItem}
  82. </foreach>
  83. </when>
  84. </choose>
  85. </foreach>
  86. </trim>
  87. </if>
  88. </foreach>
  89. </where>
  90. </sql>
  91. <sql id="Base_Column_List">
  92. <!--
  93. WARNING - @mbg.generated
  94. This element is automatically generated by MyBatis Generator, do not modify.
  95. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  96. -->
  97. id, creater, create_time, update_time, producer_id, consumer_type, title, body, subject,
  98. resource_id, resource_type, delete_sign
  99. </sql>
  100. <select id="selectByExample" parameterType="com.goafanti.common.model.MessageFromSystemExample" resultMap="BaseResultMap">
  101. <!--
  102. WARNING - @mbg.generated
  103. This element is automatically generated by MyBatis Generator, do not modify.
  104. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  105. -->
  106. select
  107. <if test="distinct">
  108. distinct
  109. </if>
  110. <include refid="Base_Column_List" />
  111. from message_from_system
  112. <if test="_parameter != null">
  113. <include refid="Example_Where_Clause" />
  114. </if>
  115. <if test="orderByClause != null">
  116. order by ${orderByClause}
  117. </if>
  118. </select>
  119. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  120. <!--
  121. WARNING - @mbg.generated
  122. This element is automatically generated by MyBatis Generator, do not modify.
  123. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  124. -->
  125. select
  126. <include refid="Base_Column_List" />
  127. from message_from_system
  128. where id = #{id,jdbcType=VARCHAR}
  129. </select>
  130. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  131. <!--
  132. WARNING - @mbg.generated
  133. This element is automatically generated by MyBatis Generator, do not modify.
  134. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  135. -->
  136. delete from message_from_system
  137. where id = #{id,jdbcType=VARCHAR}
  138. </delete>
  139. <delete id="deleteByExample" parameterType="com.goafanti.common.model.MessageFromSystemExample">
  140. <!--
  141. WARNING - @mbg.generated
  142. This element is automatically generated by MyBatis Generator, do not modify.
  143. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  144. -->
  145. delete from message_from_system
  146. <if test="_parameter != null">
  147. <include refid="Example_Where_Clause" />
  148. </if>
  149. </delete>
  150. <insert id="insert" parameterType="com.goafanti.common.model.MessageFromSystem">
  151. <!--
  152. WARNING - @mbg.generated
  153. This element is automatically generated by MyBatis Generator, do not modify.
  154. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  155. -->
  156. insert into message_from_system (id, creater, create_time,
  157. update_time, producer_id, consumer_type,
  158. title, body, subject,
  159. resource_id, resource_type, delete_sign
  160. )
  161. values (#{id,jdbcType=VARCHAR}, #{creater,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  162. #{updateTime,jdbcType=TIMESTAMP}, #{producerId,jdbcType=VARCHAR}, #{consumerType,jdbcType=INTEGER},
  163. #{title,jdbcType=VARCHAR}, #{body,jdbcType=VARCHAR}, #{subject,jdbcType=INTEGER},
  164. #{resourceId,jdbcType=VARCHAR}, #{resourceType,jdbcType=INTEGER}, #{deleteSign,jdbcType=BIT}
  165. )
  166. </insert>
  167. <insert id="insertSelective" parameterType="com.goafanti.common.model.MessageFromSystem">
  168. <!--
  169. WARNING - @mbg.generated
  170. This element is automatically generated by MyBatis Generator, do not modify.
  171. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  172. -->
  173. insert into message_from_system
  174. <trim prefix="(" suffix=")" suffixOverrides=",">
  175. <if test="id != null">
  176. id,
  177. </if>
  178. <if test="creater != null">
  179. creater,
  180. </if>
  181. <if test="createTime != null">
  182. create_time,
  183. </if>
  184. <if test="updateTime != null">
  185. update_time,
  186. </if>
  187. <if test="producerId != null">
  188. producer_id,
  189. </if>
  190. <if test="consumerType != null">
  191. consumer_type,
  192. </if>
  193. <if test="title != null">
  194. title,
  195. </if>
  196. <if test="body != null">
  197. body,
  198. </if>
  199. <if test="subject != null">
  200. subject,
  201. </if>
  202. <if test="resourceId != null">
  203. resource_id,
  204. </if>
  205. <if test="resourceType != null">
  206. resource_type,
  207. </if>
  208. <if test="deleteSign != null">
  209. delete_sign,
  210. </if>
  211. </trim>
  212. <trim prefix="values (" suffix=")" suffixOverrides=",">
  213. <if test="id != null">
  214. #{id,jdbcType=VARCHAR},
  215. </if>
  216. <if test="creater != null">
  217. #{creater,jdbcType=VARCHAR},
  218. </if>
  219. <if test="createTime != null">
  220. #{createTime,jdbcType=TIMESTAMP},
  221. </if>
  222. <if test="updateTime != null">
  223. #{updateTime,jdbcType=TIMESTAMP},
  224. </if>
  225. <if test="producerId != null">
  226. #{producerId,jdbcType=VARCHAR},
  227. </if>
  228. <if test="consumerType != null">
  229. #{consumerType,jdbcType=INTEGER},
  230. </if>
  231. <if test="title != null">
  232. #{title,jdbcType=VARCHAR},
  233. </if>
  234. <if test="body != null">
  235. #{body,jdbcType=VARCHAR},
  236. </if>
  237. <if test="subject != null">
  238. #{subject,jdbcType=INTEGER},
  239. </if>
  240. <if test="resourceId != null">
  241. #{resourceId,jdbcType=VARCHAR},
  242. </if>
  243. <if test="resourceType != null">
  244. #{resourceType,jdbcType=INTEGER},
  245. </if>
  246. <if test="deleteSign != null">
  247. #{deleteSign,jdbcType=BIT},
  248. </if>
  249. </trim>
  250. </insert>
  251. <select id="countByExample" parameterType="com.goafanti.common.model.MessageFromSystemExample" resultType="java.lang.Long">
  252. <!--
  253. WARNING - @mbg.generated
  254. This element is automatically generated by MyBatis Generator, do not modify.
  255. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  256. -->
  257. select count(*) from message_from_system
  258. <if test="_parameter != null">
  259. <include refid="Example_Where_Clause" />
  260. </if>
  261. </select>
  262. <update id="updateByExampleSelective" parameterType="map">
  263. <!--
  264. WARNING - @mbg.generated
  265. This element is automatically generated by MyBatis Generator, do not modify.
  266. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  267. -->
  268. update message_from_system
  269. <set>
  270. <if test="record.id != null">
  271. id = #{record.id,jdbcType=VARCHAR},
  272. </if>
  273. <if test="record.creater != null">
  274. creater = #{record.creater,jdbcType=VARCHAR},
  275. </if>
  276. <if test="record.createTime != null">
  277. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  278. </if>
  279. <if test="record.updateTime != null">
  280. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  281. </if>
  282. <if test="record.producerId != null">
  283. producer_id = #{record.producerId,jdbcType=VARCHAR},
  284. </if>
  285. <if test="record.consumerType != null">
  286. consumer_type = #{record.consumerType,jdbcType=INTEGER},
  287. </if>
  288. <if test="record.title != null">
  289. title = #{record.title,jdbcType=VARCHAR},
  290. </if>
  291. <if test="record.body != null">
  292. body = #{record.body,jdbcType=VARCHAR},
  293. </if>
  294. <if test="record.subject != null">
  295. subject = #{record.subject,jdbcType=INTEGER},
  296. </if>
  297. <if test="record.resourceId != null">
  298. resource_id = #{record.resourceId,jdbcType=VARCHAR},
  299. </if>
  300. <if test="record.resourceType != null">
  301. resource_type = #{record.resourceType,jdbcType=INTEGER},
  302. </if>
  303. <if test="record.deleteSign != null">
  304. delete_sign = #{record.deleteSign,jdbcType=BIT},
  305. </if>
  306. </set>
  307. <if test="_parameter != null">
  308. <include refid="Update_By_Example_Where_Clause" />
  309. </if>
  310. </update>
  311. <update id="updateByExample" parameterType="map">
  312. <!--
  313. WARNING - @mbg.generated
  314. This element is automatically generated by MyBatis Generator, do not modify.
  315. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  316. -->
  317. update message_from_system
  318. set id = #{record.id,jdbcType=VARCHAR},
  319. creater = #{record.creater,jdbcType=VARCHAR},
  320. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  321. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  322. producer_id = #{record.producerId,jdbcType=VARCHAR},
  323. consumer_type = #{record.consumerType,jdbcType=INTEGER},
  324. title = #{record.title,jdbcType=VARCHAR},
  325. body = #{record.body,jdbcType=VARCHAR},
  326. subject = #{record.subject,jdbcType=INTEGER},
  327. resource_id = #{record.resourceId,jdbcType=VARCHAR},
  328. resource_type = #{record.resourceType,jdbcType=INTEGER},
  329. delete_sign = #{record.deleteSign,jdbcType=BIT}
  330. <if test="_parameter != null">
  331. <include refid="Update_By_Example_Where_Clause" />
  332. </if>
  333. </update>
  334. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.MessageFromSystem">
  335. <!--
  336. WARNING - @mbg.generated
  337. This element is automatically generated by MyBatis Generator, do not modify.
  338. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  339. -->
  340. update message_from_system
  341. <set>
  342. <if test="creater != null">
  343. creater = #{creater,jdbcType=VARCHAR},
  344. </if>
  345. <if test="createTime != null">
  346. create_time = #{createTime,jdbcType=TIMESTAMP},
  347. </if>
  348. <if test="updateTime != null">
  349. update_time = #{updateTime,jdbcType=TIMESTAMP},
  350. </if>
  351. <if test="producerId != null">
  352. producer_id = #{producerId,jdbcType=VARCHAR},
  353. </if>
  354. <if test="consumerType != null">
  355. consumer_type = #{consumerType,jdbcType=INTEGER},
  356. </if>
  357. <if test="title != null">
  358. title = #{title,jdbcType=VARCHAR},
  359. </if>
  360. <if test="body != null">
  361. body = #{body,jdbcType=VARCHAR},
  362. </if>
  363. <if test="subject != null">
  364. subject = #{subject,jdbcType=INTEGER},
  365. </if>
  366. <if test="resourceId != null">
  367. resource_id = #{resourceId,jdbcType=VARCHAR},
  368. </if>
  369. <if test="resourceType != null">
  370. resource_type = #{resourceType,jdbcType=INTEGER},
  371. </if>
  372. <if test="deleteSign != null">
  373. delete_sign = #{deleteSign,jdbcType=BIT},
  374. </if>
  375. </set>
  376. where id = #{id,jdbcType=VARCHAR}
  377. </update>
  378. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.MessageFromSystem">
  379. <!--
  380. WARNING - @mbg.generated
  381. This element is automatically generated by MyBatis Generator, do not modify.
  382. This element was generated on Thu Dec 14 21:04:23 CST 2017.
  383. -->
  384. update message_from_system
  385. set creater = #{creater,jdbcType=VARCHAR},
  386. create_time = #{createTime,jdbcType=TIMESTAMP},
  387. update_time = #{updateTime,jdbcType=TIMESTAMP},
  388. producer_id = #{producerId,jdbcType=VARCHAR},
  389. consumer_type = #{consumerType,jdbcType=INTEGER},
  390. title = #{title,jdbcType=VARCHAR},
  391. body = #{body,jdbcType=VARCHAR},
  392. subject = #{subject,jdbcType=INTEGER},
  393. resource_id = #{resourceId,jdbcType=VARCHAR},
  394. resource_type = #{resourceType,jdbcType=INTEGER},
  395. delete_sign = #{deleteSign,jdbcType=BIT}
  396. where id = #{id,jdbcType=VARCHAR}
  397. </update>
  398. <insert id="insertBatchProducer" parameterType="com.goafanti.common.model.MessageProducer">
  399. insert into message_producer (id,consumer_id,message_id)
  400. values
  401. <foreach item="item" index="index" collection="list" separator=",">
  402. (
  403. #{item.id,jdbcType=VARCHAR},#{item.consumerId,jdbcType=VARCHAR},#{item.messageId,jdbcType=VARCHAR}
  404. )
  405. </foreach>
  406. </insert>
  407. <insert id="insertBatchConsumer" parameterType="com.goafanti.common.model.MessageConsumer">
  408. insert into message_consumer (id,consumer_id,message_id)
  409. values
  410. <foreach item="item" index="index" collection="list" separator=",">
  411. (
  412. #{item.id,jdbcType=VARCHAR},#{item.consumerId,jdbcType=VARCHAR},#{item.messageId,jdbcType=VARCHAR}
  413. )
  414. </foreach>
  415. </insert>
  416. <select id="selectSendMessage" parameterType="java.lang.String" resultType="com.goafanti.message.bo.MessageBo">
  417. select
  418. a.id,
  419. a.message_id as messageId,
  420. b.registration_id as registrationId
  421. from
  422. message_producer a left join jpush_easemob_account b on
  423. a.consumer_id = b.uid
  424. where
  425. a.message_id is not null
  426. and a.send_time is null
  427. and a.consumer_id = #{uid,jdbcType=VARCHAR};
  428. </select>
  429. <update id="updateJpushEasemobAccount" parameterType="java.lang.String">
  430. update jpush_easemob_account
  431. <set>
  432. <if test="uuid != null and uuid != ''">
  433. uuid = #{uuid,jdbcType=VARCHAR}
  434. </if>
  435. <if test="registrationId != null and registrationId != ''">
  436. registration_id = #{registrationId,jdbcType=VARCHAR}
  437. </if>
  438. <if test="userName != null and userName != ''">
  439. username = #{userName,jdbcType=VARCHAR}
  440. </if>
  441. where uid = #{uid,jdbcType=VARCHAR}
  442. </set>
  443. </update>
  444. <update id="updateMessageConsumer">
  445. update message_consumer
  446. <set>
  447. read_time = #{readTime,jdbcType=TIMESTAMP} where uid = #{uid,jdbcType=VARCHAR} and message_id = #{messageId,jdbcType=VARCHAR}
  448. </set>
  449. </update>
  450. <select id="selectSendTarget" parameterType="java.lang.String" resultType="java.lang.String">
  451. #{sql,jdbcType=VARCHAR}
  452. </select>
  453. <select id="selectRecommendTarget" parameterType="java.lang.String" resultType="com.goafanti.common.model.MessageFromSystem">
  454. #{sql,jdbcType=VARCHAR}
  455. </select>
  456. </mapper>