CouponInfoMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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.CouponInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.CouponInfo">
  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="name" property="name" jdbcType="VARCHAR"/>
  12. <result column="discription" property="discription" jdbcType="VARCHAR"/>
  13. <result column="discount_money" property="discountMoney" jdbcType="DECIMAL"/>
  14. <result column="limit_money" property="limitMoney" jdbcType="DECIMAL"/>
  15. <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
  16. <result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
  17. <result column="available_days" property="availableDays" jdbcType="INTEGER"/>
  18. <result column="use_times" property="useTimes" jdbcType="INTEGER"/>
  19. <result column="begin_time" property="beginTime" jdbcType="TIMESTAMP"/>
  20. <result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
  21. <result column="on_shelf" property="onShelf" jdbcType="CHAR"/>
  22. <result column="open_flag" property="openFlag" jdbcType="CHAR"/>
  23. <result column="store_id" property="storeId" jdbcType="INTEGER"/>
  24. </resultMap>
  25. <sql id="Base_Column_List">
  26. <trim suffixOverrides=",">
  27. id,
  28. del_flag,
  29. update_time,
  30. update_user,
  31. create_time,
  32. create_user,
  33. name,
  34. discription,
  35. discount_money,
  36. limit_money,
  37. type_flag,
  38. status_flag,
  39. available_days,
  40. use_times,
  41. begin_time,
  42. end_time,
  43. on_shelf,
  44. open_flag,
  45. store_id,
  46. </trim>
  47. </sql>
  48. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  49. select
  50. <include refid="Base_Column_List"/>
  51. from coupon_info
  52. where id = #{id,jdbcType=INTEGER}
  53. </select>
  54. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  55. delete from coupon_info
  56. where id = #{id,jdbcType=INTEGER}
  57. </delete>
  58. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.CouponInfo" useGeneratedKeys="true"
  59. keyProperty="id">
  60. insert into coupon_info
  61. <trim prefix="(" suffix=")" suffixOverrides=",">
  62. <if test="id!= null">
  63. id,
  64. </if>
  65. <if test="delFlag!= null">
  66. del_flag,
  67. </if>
  68. <if test="updateTime!= null">
  69. update_time,
  70. </if>
  71. <if test="updateUser!= null">
  72. update_user,
  73. </if>
  74. <if test="createTime!= null">
  75. create_time,
  76. </if>
  77. <if test="createUser!= null">
  78. create_user,
  79. </if>
  80. <if test="name!= null">
  81. name,
  82. </if>
  83. <if test="discription!= null">
  84. discription,
  85. </if>
  86. <if test="discountMoney!= null">
  87. discount_money,
  88. </if>
  89. <if test="limitMoney!= null">
  90. limit_money,
  91. </if>
  92. <if test="typeFlag!= null">
  93. type_flag,
  94. </if>
  95. <if test="statusFlag!= null">
  96. status_flag,
  97. </if>
  98. <if test="availableDays!= null">
  99. available_days,
  100. </if>
  101. <if test="useTimes!= null">
  102. use_times,
  103. </if>
  104. <if test="beginTime!= null">
  105. begin_time,
  106. </if>
  107. <if test="endTime!= null">
  108. end_time,
  109. </if>
  110. <if test="onShelf!= null">
  111. on_shelf,
  112. </if>
  113. <if test="openFlag!= null">
  114. open_flag,
  115. </if>
  116. <if test="storeId!= null">
  117. store_id,
  118. </if>
  119. </trim>
  120. <trim prefix="values (" suffix=")" suffixOverrides=",">
  121. <if test="id != null">
  122. #{id,jdbcType=INTEGER},
  123. </if>
  124. <if test="delFlag != null">
  125. #{delFlag,jdbcType=CHAR},
  126. </if>
  127. <if test="updateTime != null">
  128. #{updateTime,jdbcType=TIMESTAMP},
  129. </if>
  130. <if test="updateUser != null">
  131. #{updateUser,jdbcType=VARCHAR},
  132. </if>
  133. <if test="createTime != null">
  134. #{createTime,jdbcType=TIMESTAMP},
  135. </if>
  136. <if test="createUser != null">
  137. #{createUser,jdbcType=VARCHAR},
  138. </if>
  139. <if test="name != null">
  140. #{name,jdbcType=VARCHAR},
  141. </if>
  142. <if test="discription != null">
  143. #{discription,jdbcType=VARCHAR},
  144. </if>
  145. <if test="discountMoney != null">
  146. #{discountMoney,jdbcType=DECIMAL},
  147. </if>
  148. <if test="limitMoney != null">
  149. #{limitMoney,jdbcType=DECIMAL},
  150. </if>
  151. <if test="typeFlag != null">
  152. #{typeFlag,jdbcType=INTEGER},
  153. </if>
  154. <if test="statusFlag != null">
  155. #{statusFlag,jdbcType=INTEGER},
  156. </if>
  157. <if test="availableDays != null">
  158. #{availableDays,jdbcType=INTEGER},
  159. </if>
  160. <if test="useTimes != null">
  161. #{useTimes,jdbcType=INTEGER},
  162. </if>
  163. <if test="beginTime != null">
  164. #{beginTime,jdbcType=TIMESTAMP},
  165. </if>
  166. <if test="endTime != null">
  167. #{endTime,jdbcType=TIMESTAMP},
  168. </if>
  169. <if test="onShelf != null">
  170. #{onShelf,jdbcType=CHAR},
  171. </if>
  172. <if test="openFlag != null">
  173. #{openFlag,jdbcType=CHAR},
  174. </if>
  175. <if test="storeId != null">
  176. #{storeId,jdbcType=INTEGER},
  177. </if>
  178. </trim>
  179. </insert>
  180. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.CouponInfo">
  181. update coupon_info
  182. <set>
  183. <if test="id != null">
  184. id= #{id,jdbcType=INTEGER},
  185. </if>
  186. <if test="delFlag != null">
  187. del_flag= #{delFlag,jdbcType=CHAR},
  188. </if>
  189. <if test="updateTime != null">
  190. update_time= #{updateTime,jdbcType=TIMESTAMP},
  191. </if>
  192. <if test="updateUser != null">
  193. update_user= #{updateUser,jdbcType=VARCHAR},
  194. </if>
  195. <if test="createTime != null">
  196. create_time= #{createTime,jdbcType=TIMESTAMP},
  197. </if>
  198. <if test="createUser != null">
  199. create_user= #{createUser,jdbcType=VARCHAR},
  200. </if>
  201. <if test="name != null">
  202. name= #{name,jdbcType=VARCHAR},
  203. </if>
  204. <if test="discription != null">
  205. discription= #{discription,jdbcType=VARCHAR},
  206. </if>
  207. <if test="discountMoney != null">
  208. discount_money= #{discountMoney,jdbcType=DECIMAL},
  209. </if>
  210. <if test="limitMoney != null">
  211. limit_money= #{limitMoney,jdbcType=DECIMAL},
  212. </if>
  213. <if test="typeFlag != null">
  214. type_flag= #{typeFlag,jdbcType=INTEGER},
  215. </if>
  216. <if test="statusFlag != null">
  217. status_flag= #{statusFlag,jdbcType=INTEGER},
  218. </if>
  219. <if test="availableDays != null">
  220. available_days= #{availableDays,jdbcType=INTEGER},
  221. </if>
  222. <if test="useTimes != null">
  223. use_times= #{useTimes,jdbcType=INTEGER},
  224. </if>
  225. <if test="beginTime != null">
  226. begin_time= #{beginTime,jdbcType=TIMESTAMP},
  227. </if>
  228. <if test="endTime != null">
  229. end_time= #{endTime,jdbcType=TIMESTAMP},
  230. </if>
  231. <if test="onShelf != null">
  232. on_shelf= #{onShelf,jdbcType=CHAR},
  233. </if>
  234. <if test="openFlag != null">
  235. open_flag= #{openFlag,jdbcType=CHAR},
  236. </if>
  237. <if test="storeId != null">
  238. store_id= #{storeId,jdbcType=INTEGER},
  239. </if>
  240. </set>
  241. where
  242. <if test="id != null and !&quot;&quot;.equals(id)">
  243. id = #{id,jdbcType=INTEGER}
  244. </if>
  245. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  246. id in (${idStr})
  247. </if>
  248. </update>
  249. <select id="queryCouponInfoByPage" parameterType="java.util.Map"
  250. resultType="com.izouma.awesomeadmin.model.CouponInfo">
  251. select
  252. <include refid="Base_Column_List"/>
  253. from coupon_info
  254. <where>
  255. and del_flag = 'N'
  256. <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
  257. and id in (${record.idStr})
  258. </if>
  259. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  260. and id = #{record.id}
  261. </if>
  262. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  263. and del_flag = #{record.delFlag}
  264. </if>
  265. <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
  266. and update_time = #{record.updateTime}
  267. </if>
  268. <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
  269. and update_user = #{record.updateUser}
  270. </if>
  271. <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
  272. and create_time = #{record.createTime}
  273. </if>
  274. <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
  275. and create_user = #{record.createUser}
  276. </if>
  277. <if test="record.name != null and !&quot;&quot;.equals(record.name)">
  278. and name = #{record.name}
  279. </if>
  280. <if test="record.discription != null and !&quot;&quot;.equals(record.discription)">
  281. and discription = #{record.discription}
  282. </if>
  283. <if test="record.discountMoney != null and !&quot;&quot;.equals(record.discountMoney)">
  284. and discount_money = #{record.discountMoney}
  285. </if>
  286. <if test="record.limitMoney != null and !&quot;&quot;.equals(record.limitMoney)">
  287. and limit_money = #{record.limitMoney}
  288. </if>
  289. <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
  290. and type_flag = #{record.typeFlag}
  291. </if>
  292. <if test="record.statusFlag != null and !&quot;&quot;.equals(record.statusFlag)">
  293. and status_flag = #{record.statusFlag}
  294. </if>
  295. <if test="record.availableDays != null and !&quot;&quot;.equals(record.availableDays)">
  296. and available_days = #{record.availableDays}
  297. </if>
  298. <if test="record.useTimes != null and !&quot;&quot;.equals(record.useTimes)">
  299. and use_times = #{record.useTimes}
  300. </if>
  301. <if test="record.beginTime != null and !&quot;&quot;.equals(record.beginTime)">
  302. and begin_time = #{record.beginTime}
  303. </if>
  304. <if test="record.endTime != null and !&quot;&quot;.equals(record.endTime)">
  305. and end_time = #{record.endTime}
  306. </if>
  307. <if test="record.onShelf != null and !&quot;&quot;.equals(record.onShelf)">
  308. and on_shelf = #{record.onShelf}
  309. </if>
  310. <if test="record.openFlag != null and !&quot;&quot;.equals(record.openFlag)">
  311. and open_flag = #{record.openFlag}
  312. </if>
  313. <if test="record.storeId != null and !&quot;&quot;.equals(record.storeId)">
  314. and store_id = #{record.storeId}
  315. </if>
  316. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  317. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  318. OR name LIKE concat('%',#{record.searchKey},'%')
  319. OR discription LIKE concat('%',#{record.searchKey},'%')
  320. OR discount_money LIKE concat('%',#{record.searchKey},'%')
  321. OR limit_money LIKE concat('%',#{record.searchKey},'%')
  322. OR on_shelf LIKE concat('%',#{record.searchKey},'%')
  323. OR open_flag LIKE concat('%',#{record.searchKey},'%')
  324. OR store_id LIKE concat('%',#{record.searchKey},'%')
  325. </trim>
  326. </if>
  327. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  328. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  329. <choose>
  330. <when test="item.indexOf('like') != -1">
  331. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  332. <if test="detailIndex == 3">
  333. concat('%',#{itemDetail},'%')
  334. </if>
  335. <if test="detailIndex &lt; 3">
  336. ${itemDetail}
  337. </if>
  338. </foreach>
  339. </when>
  340. <otherwise>
  341. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  342. <if test="detailIndex == 3">
  343. #{itemDetail}
  344. </if>
  345. <if test="detailIndex &lt; 3">
  346. ${itemDetail}
  347. </if>
  348. </foreach>
  349. </otherwise>
  350. </choose>
  351. </foreach>
  352. </if>
  353. </where>
  354. order by
  355. <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
  356. <trim suffixOverrides=",">
  357. <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
  358. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  359. ${itemDetail}
  360. </foreach>
  361. </foreach>
  362. </trim>
  363. ,
  364. </if>
  365. id desc
  366. </select>
  367. <select id="queryAllCouponInfo" parameterType="java.util.Map" resultMap="AllCouponInfoResult">
  368. select
  369. <include refid="Base_Column_List"/>
  370. , #{receiveFlag} as receive_flag
  371. <if test="userId != null and !&quot;&quot;.equals(userId)">
  372. , (
  373. SELECT
  374. COUNT(1)
  375. FROM
  376. user_coupon
  377. WHERE
  378. del_flag = 'N'
  379. AND coupon_id = coupon_info.id
  380. and user_id = #{userId}
  381. ) as user_count
  382. </if>
  383. from coupon_info
  384. <where>
  385. and del_flag = 'N'
  386. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  387. and id in (${idStr})
  388. </if>
  389. <if test="id != null and !&quot;&quot;.equals(id)">
  390. and id = #{id}
  391. </if>
  392. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  393. and del_flag = #{delFlag}
  394. </if>
  395. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  396. and update_time = #{updateTime}
  397. </if>
  398. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  399. and update_user = #{updateUser}
  400. </if>
  401. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  402. and create_time = #{createTime}
  403. </if>
  404. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  405. and create_user = #{createUser}
  406. </if>
  407. <if test="name != null and !&quot;&quot;.equals(name)">
  408. and name = #{name}
  409. </if>
  410. <if test="discription != null and !&quot;&quot;.equals(discription)">
  411. and discription = #{discription}
  412. </if>
  413. <if test="discountMoney != null and !&quot;&quot;.equals(discountMoney)">
  414. and discount_money = #{discountMoney}
  415. </if>
  416. <if test="limitMoney != null and !&quot;&quot;.equals(limitMoney)">
  417. and limit_money = #{limitMoney}
  418. </if>
  419. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  420. and type_flag = #{typeFlag}
  421. </if>
  422. <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
  423. and status_flag = #{statusFlag}
  424. </if>
  425. <if test="availableDays != null and !&quot;&quot;.equals(availableDays)">
  426. and available_days = #{availableDays}
  427. </if>
  428. <if test="useTimes != null and !&quot;&quot;.equals(useTimes)">
  429. and use_times = #{useTimes}
  430. </if>
  431. <if test="beginTime != null and !&quot;&quot;.equals(beginTime)">
  432. and begin_time = #{beginTime}
  433. </if>
  434. <if test="endTime != null and !&quot;&quot;.equals(endTime)">
  435. and end_time = #{endTime}
  436. </if>
  437. <if test="onShelf != null and !&quot;&quot;.equals(onShelf)">
  438. and on_shelf = #{onShelf}
  439. </if>
  440. <if test="openFlag != null and !&quot;&quot;.equals(openFlag)">
  441. and open_flag = #{openFlag}
  442. </if>
  443. <if test="storeId != null and !&quot;&quot;.equals(storeId)">
  444. and store_id = #{storeId}
  445. </if>
  446. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  447. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  448. OR name LIKE concat('%',#{searchKey},'%')
  449. OR discription LIKE concat('%',#{searchKey},'%')
  450. OR discount_money LIKE concat('%',#{searchKey},'%')
  451. OR limit_money LIKE concat('%',#{searchKey},'%')
  452. OR on_shelf LIKE concat('%',#{searchKey},'%')
  453. OR open_flag LIKE concat('%',#{searchKey},'%')
  454. OR store_id LIKE concat('%',#{searchKey},'%')
  455. </trim>
  456. </if>
  457. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  458. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  459. <choose>
  460. <when test="item.indexOf('like') != -1">
  461. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  462. <if test="detailIndex == 3">
  463. concat('%',#{itemDetail},'%')
  464. </if>
  465. <if test="detailIndex &lt; 3">
  466. ${itemDetail}
  467. </if>
  468. </foreach>
  469. </when>
  470. <otherwise>
  471. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  472. <if test="detailIndex == 3">
  473. #{itemDetail}
  474. </if>
  475. <if test="detailIndex &lt; 3">
  476. ${itemDetail}
  477. </if>
  478. </foreach>
  479. </otherwise>
  480. </choose>
  481. </foreach>
  482. </if>
  483. </where>
  484. order by
  485. <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
  486. <trim suffixOverrides=",">
  487. <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
  488. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  489. ${itemDetail}
  490. </foreach>
  491. </foreach>
  492. </trim>
  493. ,
  494. </if>
  495. id desc
  496. </select>
  497. <select id="queryCouponInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CouponInfo">
  498. select
  499. <include refid="Base_Column_List"/>
  500. from coupon_info
  501. <where>
  502. and del_flag = 'N'
  503. <if test="id != null and !&quot;&quot;.equals(id)">
  504. and id = #{id}
  505. </if>
  506. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  507. and del_flag = #{delFlag}
  508. </if>
  509. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  510. and update_time = #{updateTime}
  511. </if>
  512. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  513. and update_user = #{updateUser}
  514. </if>
  515. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  516. and create_time = #{createTime}
  517. </if>
  518. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  519. and create_user = #{createUser}
  520. </if>
  521. <if test="name != null and !&quot;&quot;.equals(name)">
  522. and name = #{name}
  523. </if>
  524. <if test="discription != null and !&quot;&quot;.equals(discription)">
  525. and discription = #{discription}
  526. </if>
  527. <if test="discountMoney != null and !&quot;&quot;.equals(discountMoney)">
  528. and discount_money = #{discountMoney}
  529. </if>
  530. <if test="limitMoney != null and !&quot;&quot;.equals(limitMoney)">
  531. and limit_money = #{limitMoney}
  532. </if>
  533. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  534. and type_flag = #{typeFlag}
  535. </if>
  536. <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
  537. and status_flag = #{statusFlag}
  538. </if>
  539. <if test="availableDays != null and !&quot;&quot;.equals(availableDays)">
  540. and available_days = #{availableDays}
  541. </if>
  542. <if test="useTimes != null and !&quot;&quot;.equals(useTimes)">
  543. and use_times = #{useTimes}
  544. </if>
  545. <if test="beginTime != null and !&quot;&quot;.equals(beginTime)">
  546. and begin_time = #{beginTime}
  547. </if>
  548. <if test="endTime != null and !&quot;&quot;.equals(endTime)">
  549. and end_time = #{endTime}
  550. </if>
  551. <if test="onShelf != null and !&quot;&quot;.equals(onShelf)">
  552. and on_shelf = #{onShelf}
  553. </if>
  554. <if test="openFlag != null and !&quot;&quot;.equals(openFlag)">
  555. and open_flag = #{openFlag}
  556. </if>
  557. <if test="storeId != null and !&quot;&quot;.equals(storeId)">
  558. and store_id = #{storeId}
  559. </if>
  560. </where>
  561. LIMIT 1
  562. </select>
  563. <update id="delete">
  564. UPDATE coupon_info SET del_flag = 'Y'
  565. where
  566. <if test="id != null and !&quot;&quot;.equals(id)">
  567. id = #{id,jdbcType=INTEGER}
  568. </if>
  569. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  570. id in (${idStr})
  571. </if>
  572. </update>
  573. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CouponInfo">
  574. select
  575. <include refid="Base_Column_List"/>
  576. from coupon_info
  577. <where>
  578. and del_flag = 'N'
  579. </where>
  580. order by id desc
  581. </select>
  582. <resultMap id="AllCouponInfoResult" type="com.izouma.awesomeadmin.model.CouponInfo"
  583. extends="BaseResultMap">
  584. <association property="storeInfo"
  585. javaType="com.izouma.awesomeadmin.model.StoreInfo"
  586. select="com.izouma.awesomeadmin.dao.StoreInfoMapper.queryStoreInfo"
  587. column="{ id = store_id }"/>
  588. <collection property="couponDetailList"
  589. ofType="com.izouma.awesomeadmin.model.CouponDetail"
  590. select="com.izouma.awesomeadmin.dao.CouponDetailMapper.queryAllCouponDetail"
  591. column="{ couponId = id, receiveFlag = receive_flag }"/>
  592. </resultMap>
  593. </mapper>