MemberCoinMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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.izouma.awesomeadmin.dao.MemberCoinMapper">
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.MemberCoin">
  5. <id column="id" property="id" jdbcType="INTEGER"/>
  6. <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
  7. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  8. <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  10. <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
  11. <result column="user_id" property="userId" jdbcType="VARCHAR"/>
  12. <result column="order_id" property="orderId" jdbcType="VARCHAR"/>
  13. <result column="money" property="money" jdbcType="VARCHAR"/>
  14. <result column="balance" property="balance" jdbcType="VARCHAR"/>
  15. <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
  16. <result column="remark" property="remark" jdbcType="VARCHAR"/>
  17. </resultMap>
  18. <sql id="Base_Column_List">
  19. <trim suffixOverrides=",">
  20. id,
  21. del_flag,
  22. update_time,
  23. update_user,
  24. create_time,
  25. create_user,
  26. user_id,
  27. order_id,
  28. money,
  29. balance,
  30. type_flag,
  31. remark,
  32. </trim>
  33. </sql>
  34. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  35. select
  36. <include refid="Base_Column_List"/>
  37. from member_coin
  38. where id = #{id,jdbcType=INTEGER}
  39. </select>
  40. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  41. delete from member_coin
  42. where id = #{id,jdbcType=INTEGER}
  43. </delete>
  44. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.MemberCoin" useGeneratedKeys="true"
  45. keyProperty="id">
  46. insert into member_coin
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="id!= null">
  49. id,
  50. </if>
  51. <if test="delFlag!= null">
  52. del_flag,
  53. </if>
  54. <if test="updateTime!= null">
  55. update_time,
  56. </if>
  57. <if test="updateUser!= null">
  58. update_user,
  59. </if>
  60. <if test="createTime!= null">
  61. create_time,
  62. </if>
  63. <if test="createUser!= null">
  64. create_user,
  65. </if>
  66. <if test="userId!= null">
  67. user_id,
  68. </if>
  69. <if test="orderId!= null">
  70. order_id,
  71. </if>
  72. <if test="money!= null">
  73. money,
  74. </if>
  75. <if test="balance!= null">
  76. balance,
  77. </if>
  78. <if test="typeFlag!= null">
  79. type_flag,
  80. </if>
  81. <if test="remark!= null">
  82. remark,
  83. </if>
  84. </trim>
  85. <trim prefix="values (" suffix=")" suffixOverrides=",">
  86. <if test="id != null">
  87. #{id,jdbcType=INTEGER},
  88. </if>
  89. <if test="delFlag != null">
  90. #{delFlag,jdbcType=CHAR},
  91. </if>
  92. <if test="updateTime != null">
  93. #{updateTime,jdbcType=TIMESTAMP},
  94. </if>
  95. <if test="updateUser != null">
  96. #{updateUser,jdbcType=VARCHAR},
  97. </if>
  98. <if test="createTime != null">
  99. #{createTime,jdbcType=TIMESTAMP},
  100. </if>
  101. <if test="createUser != null">
  102. #{createUser,jdbcType=VARCHAR},
  103. </if>
  104. <if test="userId != null">
  105. #{userId,jdbcType=VARCHAR},
  106. </if>
  107. <if test="orderId != null">
  108. #{orderId,jdbcType=VARCHAR},
  109. </if>
  110. <if test="money != null">
  111. #{money,jdbcType=VARCHAR},
  112. </if>
  113. <if test="balance != null">
  114. #{balance,jdbcType=VARCHAR},
  115. </if>
  116. <if test="typeFlag != null">
  117. #{typeFlag,jdbcType=INTEGER},
  118. </if>
  119. <if test="remark != null">
  120. #{remark,jdbcType=VARCHAR},
  121. </if>
  122. </trim>
  123. </insert>
  124. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.MemberCoin">
  125. update member_coin
  126. <set>
  127. <if test="id != null">
  128. id= #{id,jdbcType=INTEGER},
  129. </if>
  130. <if test="delFlag != null">
  131. del_flag= #{delFlag,jdbcType=CHAR},
  132. </if>
  133. <if test="updateTime != null">
  134. update_time= #{updateTime,jdbcType=TIMESTAMP},
  135. </if>
  136. <if test="updateUser != null">
  137. update_user= #{updateUser,jdbcType=VARCHAR},
  138. </if>
  139. <if test="createTime != null">
  140. create_time= #{createTime,jdbcType=TIMESTAMP},
  141. </if>
  142. <if test="createUser != null">
  143. create_user= #{createUser,jdbcType=VARCHAR},
  144. </if>
  145. <if test="userId != null">
  146. user_id= #{userId,jdbcType=VARCHAR},
  147. </if>
  148. <if test="orderId != null">
  149. order_id= #{orderId,jdbcType=VARCHAR},
  150. </if>
  151. <if test="money != null">
  152. money= #{money,jdbcType=VARCHAR},
  153. </if>
  154. <if test="balance != null">
  155. balance= #{balance,jdbcType=VARCHAR},
  156. </if>
  157. <if test="typeFlag != null">
  158. type_flag= #{typeFlag,jdbcType=INTEGER},
  159. </if>
  160. <if test="remark != null">
  161. remark= #{remark,jdbcType=VARCHAR},
  162. </if>
  163. </set>
  164. where id = #{id,jdbcType=INTEGER}
  165. </update>
  166. <select id="queryMemberCoinByPage" parameterType="java.util.Map"
  167. resultType="com.izouma.awesomeadmin.model.MemberCoin">
  168. select
  169. <include refid="Base_Column_List"/>
  170. from member_coin
  171. <where>
  172. and del_flag = 'N'
  173. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  174. and id = #{record.id}
  175. </if>
  176. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  177. and del_flag = #{record.delFlag}
  178. </if>
  179. <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
  180. and update_time = #{record.updateTime}
  181. </if>
  182. <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
  183. and update_user = #{record.updateUser}
  184. </if>
  185. <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
  186. and create_time = #{record.createTime}
  187. </if>
  188. <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
  189. and create_user = #{record.createUser}
  190. </if>
  191. <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
  192. and user_id = #{record.userId}
  193. </if>
  194. <if test="record.orderId != null and !&quot;&quot;.equals(record.orderId)">
  195. and order_id = #{record.orderId}
  196. </if>
  197. <if test="record.money != null and !&quot;&quot;.equals(record.money)">
  198. and money = #{record.money}
  199. </if>
  200. <if test="record.balance != null and !&quot;&quot;.equals(record.balance)">
  201. and balance = #{record.balance}
  202. </if>
  203. <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
  204. and type_flag = #{record.typeFlag}
  205. </if>
  206. <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
  207. and remark = #{record.remark}
  208. </if>
  209. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  210. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  211. OR user_id LIKE concat('%',#{record.searchKey},'%')
  212. OR order_id LIKE concat('%',#{record.searchKey},'%')
  213. OR money LIKE concat('%',#{record.searchKey},'%')
  214. OR balance LIKE concat('%',#{record.searchKey},'%')
  215. OR type_flag LIKE concat('%',#{record.searchKey},'%')
  216. OR remark LIKE concat('%',#{record.searchKey},'%')
  217. </trim>
  218. </if>
  219. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  220. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  221. <choose>
  222. <when test="item.indexOf('like') != -1">
  223. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  224. <if test="detailIndex == 3">
  225. concat('%',#{itemDetail},'%')
  226. </if>
  227. <if test="detailIndex &lt; 3">
  228. ${itemDetail}
  229. </if>
  230. </foreach>
  231. </when>
  232. <otherwise>
  233. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  234. <if test="detailIndex == 3">
  235. #{itemDetail}
  236. </if>
  237. <if test="detailIndex &lt; 3">
  238. ${itemDetail}
  239. </if>
  240. </foreach>
  241. </otherwise>
  242. </choose>
  243. </foreach>
  244. </if>
  245. </where>
  246. order by
  247. <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
  248. <trim suffixOverrides=",">
  249. <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
  250. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  251. ${itemDetail}
  252. </foreach>
  253. </foreach>
  254. </trim>
  255. ,
  256. </if>
  257. id desc
  258. </select>
  259. <select id="queryAllMemberCoin" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.MemberCoin">
  260. select
  261. <include refid="Base_Column_List"/>
  262. from member_coin
  263. <where>
  264. and del_flag = 'N'
  265. <if test="id != null and !&quot;&quot;.equals(id)">
  266. and id = #{id}
  267. </if>
  268. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  269. and del_flag = #{delFlag}
  270. </if>
  271. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  272. and update_time = #{updateTime}
  273. </if>
  274. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  275. and update_user = #{updateUser}
  276. </if>
  277. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  278. and create_time = #{createTime}
  279. </if>
  280. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  281. and create_user = #{createUser}
  282. </if>
  283. <if test="userId != null and !&quot;&quot;.equals(userId)">
  284. and user_id = #{userId}
  285. </if>
  286. <if test="orderId != null and !&quot;&quot;.equals(orderId)">
  287. and order_id = #{orderId}
  288. </if>
  289. <if test="money != null and !&quot;&quot;.equals(money)">
  290. and money = #{money}
  291. </if>
  292. <if test="balance != null and !&quot;&quot;.equals(balance)">
  293. and balance = #{balance}
  294. </if>
  295. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  296. and type_flag = #{typeFlag}
  297. </if>
  298. <if test="remark != null and !&quot;&quot;.equals(remark)">
  299. and remark = #{remark}
  300. </if>
  301. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  302. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  303. OR user_id LIKE concat('%',#{searchKey},'%')
  304. OR order_id LIKE concat('%',#{searchKey},'%')
  305. OR money LIKE concat('%',#{searchKey},'%')
  306. OR balance LIKE concat('%',#{searchKey},'%')
  307. OR type_flag LIKE concat('%',#{searchKey},'%')
  308. OR remark LIKE concat('%',#{searchKey},'%')
  309. </trim>
  310. </if>
  311. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  312. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  313. <choose>
  314. <when test="item.indexOf('like') != -1">
  315. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  316. <if test="detailIndex == 3">
  317. concat('%',#{itemDetail},'%')
  318. </if>
  319. <if test="detailIndex &lt; 3">
  320. ${itemDetail}
  321. </if>
  322. </foreach>
  323. </when>
  324. <otherwise>
  325. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  326. <if test="detailIndex == 3">
  327. #{itemDetail}
  328. </if>
  329. <if test="detailIndex &lt; 3">
  330. ${itemDetail}
  331. </if>
  332. </foreach>
  333. </otherwise>
  334. </choose>
  335. </foreach>
  336. </if>
  337. </where>
  338. order by
  339. <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
  340. <trim suffixOverrides=",">
  341. <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
  342. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  343. ${itemDetail}
  344. </foreach>
  345. </foreach>
  346. </trim>
  347. ,
  348. </if>
  349. id desc
  350. </select>
  351. <select id="queryMemberCoin" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.MemberCoin">
  352. select
  353. <include refid="Base_Column_List"/>
  354. from member_coin
  355. <where>
  356. and del_flag = 'N'
  357. <if test="id != null and !&quot;&quot;.equals(id)">
  358. and id = #{id}
  359. </if>
  360. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  361. and del_flag = #{delFlag}
  362. </if>
  363. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  364. and update_time = #{updateTime}
  365. </if>
  366. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  367. and update_user = #{updateUser}
  368. </if>
  369. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  370. and create_time = #{createTime}
  371. </if>
  372. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  373. and create_user = #{createUser}
  374. </if>
  375. <if test="userId != null and !&quot;&quot;.equals(userId)">
  376. and user_id = #{userId}
  377. </if>
  378. <if test="orderId != null and !&quot;&quot;.equals(orderId)">
  379. and order_id = #{orderId}
  380. </if>
  381. <if test="money != null and !&quot;&quot;.equals(money)">
  382. and money = #{money}
  383. </if>
  384. <if test="balance != null and !&quot;&quot;.equals(balance)">
  385. and balance = #{balance}
  386. </if>
  387. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  388. and type_flag = #{typeFlag}
  389. </if>
  390. <if test="remark != null and !&quot;&quot;.equals(remark)">
  391. and remark = #{remark}
  392. </if>
  393. </where>
  394. LIMIT 1
  395. </select>
  396. <update id="delete">
  397. UPDATE member_coin SET del_flag = 'Y'
  398. <where>
  399. AND id = #{id}
  400. </where>
  401. </update>
  402. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.MemberCoin">
  403. select
  404. <include refid="Base_Column_List"/>
  405. from member_coin
  406. <where>
  407. and del_flag = 'N'
  408. </where>
  409. order by id desc
  410. </select>
  411. </mapper>