MemberCoinMapper.xml 21 KB

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