MkStoreTicketDiscountDao.xml 14 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.kmall.admin.dao.mk.store.MkStoreTicketDiscountDao">
  4. <resultMap type="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity" id="mkStoreTicketDiscountMap">
  5. <result property="tickDiscId" column="tick_disc_id"/>
  6. <result property="tickDiscType" column="tick_disc_type"/>
  7. <result property="tickDiscSubTitle" column="tick_disc_sub_title"/>
  8. <result property="merchSn" column="merch_sn"/>
  9. <result property="thirdMerchSn" column="third_merch_sn"/>
  10. <result property="storeId" column="store_id"/>
  11. <result property="storeTopicId" column="store_topic_id"/>
  12. <result property="name" column="name"/>
  13. <result property="voucherMoney" column="voucher_money"/>
  14. <result property="voucherCond" column="voucher_cond"/>
  15. <result property="discRatio" column="disc_ratio"/>
  16. <result property="discCond" column="disc_cond"/>
  17. <result property="exchCond" column="exch_cond"/>
  18. <result property="effectTimeType" column="effect_time_type"/>
  19. <result property="fixBegTime" column="fix_beg_time"/>
  20. <result property="fixEndTime" column="fix_end_time"/>
  21. <result property="postponeNum" column="postpone_num"/>
  22. <result property="validDayNum" column="valid_day_num"/>
  23. <result property="ticketNum" column="ticket_num"/>
  24. <result property="applyType" column="apply_type"/>
  25. <result property="getEnter" column="get_enter"/>
  26. <result property="canShareGet" column="can_share_get"/>
  27. <result property="limitNum" column="limit_num"/>
  28. <result property="advImgUrl" column="adv_img_url"/>
  29. <result property="storeLogoUrl" column="store_logo_url"/>
  30. <result property="storeName" column="store_name"/>
  31. <result property="ticketColor" column="ticket_color"/>
  32. <result property="optDecl" column="opt_decl"/>
  33. <result property="discDecl" column="disc_decl"/>
  34. <result property="useNoti" column="use_noti"/>
  35. <result property="svrTel" column="svr_tel"/>
  36. <result property="isValid" column="is_valid"/>
  37. <result property="isPast" column="is_past"/>
  38. <result property="note" column="note"/>
  39. <result property="createrSn" column="creater_sn"/>
  40. <result property="createTime" column="create_time"/>
  41. <result property="moderSn" column="moder_sn"/>
  42. <result property="modTime" column="mod_time"/>
  43. <result property="tstm" column="tstm"/>
  44. <result property="sendType" column="send_type"/>
  45. <result property="discSellCount" column="disc_sell_count"/>
  46. <result property="discSellDoller" column="disc_sell_doller"/>
  47. <result property="guid" column="guid"/>
  48. <result property="goodsBizType" column="goods_biz_type"/>
  49. <result property="isStoreShow" column="is_store_show"/>
  50. </resultMap>
  51. <select id="queryObject" resultType="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity">
  52. select
  53. `tick_disc_id`,
  54. `tick_disc_type`,
  55. `tick_disc_sub_title`,
  56. `merch_sn`,
  57. `third_merch_sn`,
  58. `store_id`,goods_biz_type,is_store_show,
  59. `store_topic_id`,
  60. `name`,
  61. `voucher_money`,
  62. `voucher_cond`,
  63. `disc_ratio`,
  64. `disc_cond`,
  65. `exch_cond`,
  66. `effect_time_type`,
  67. `fix_beg_time`,
  68. `fix_end_time`,
  69. `postpone_num`,
  70. `valid_day_num`,
  71. `ticket_num`,
  72. `apply_type`,
  73. `get_enter`,
  74. `can_share_get`,
  75. `limit_num`,
  76. `adv_img_url`,
  77. `store_logo_url`,
  78. `store_name`,
  79. `ticket_color`,
  80. `opt_decl`,
  81. `disc_decl`,
  82. `use_noti`,
  83. `svr_tel`,
  84. `is_valid`,
  85. is_past,
  86. disc_sell_count,
  87. disc_sell_doller,
  88. `note`,
  89. `creater_sn`,
  90. `create_time`,
  91. `moder_sn`,
  92. `mod_time`,
  93. `tstm`,
  94. `send_type`,guid
  95. from mk_store_ticket_discount
  96. where tick_disc_id = #{id}
  97. </select>
  98. <select id="queryList" resultType="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity">
  99. select
  100. d.`tick_disc_id`,
  101. d.`tick_disc_type`,
  102. d.`tick_disc_sub_title`,
  103. d.`merch_sn`,
  104. d.`third_merch_sn`,
  105. d.`store_id`,goods_biz_type,
  106. d.`store_topic_id`,
  107. d.`name`,
  108. d.`voucher_money`,
  109. d.`voucher_cond`,
  110. d.`disc_ratio`,
  111. d.`disc_cond`,
  112. d.`exch_cond`,
  113. d.`effect_time_type`,
  114. d.`fix_beg_time`,
  115. d.`fix_end_time`,
  116. d.`postpone_num`,
  117. d.`valid_day_num`,
  118. d.`ticket_num`,
  119. d.`apply_type`,
  120. d.`get_enter`,
  121. d.`can_share_get`,
  122. d.`limit_num`,
  123. d.`adv_img_url`,
  124. d.`store_logo_url`,
  125. d.`store_name`,
  126. d.`ticket_color`,
  127. d.`opt_decl`,
  128. d.`disc_decl`,
  129. d.`use_noti`,
  130. d.`svr_tel`,
  131. d.`is_valid`,
  132. d.is_past,
  133. d.disc_sell_count,
  134. d.disc_sell_doller,
  135. d.`note`,
  136. d.`creater_sn`,
  137. d.`create_time`,
  138. d.`moder_sn`,
  139. d.`mod_time`,
  140. d.`tstm`,
  141. d.`send_type`,d.guid
  142. from mk_store_ticket_discount d
  143. LEFT JOIN third_merchant_biz b ON d.third_merch_sn = b.third_merch_sn
  144. WHERE 1=1
  145. <if test="name != null and name.trim() != ''">
  146. AND d.name LIKE concat('%',#{name},'%')
  147. </if>
  148. <if test="storeId != null and storeId != ''">
  149. AND d.store_id = #{storeId}
  150. </if>
  151. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  152. AND d.third_merch_sn = #{thirdMerchSn}
  153. </if>
  154. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  155. AND b.third_party_merch_code = #{thirdPartyMerchCode}
  156. </if>
  157. <choose>
  158. <when test="sidx != null and sidx.trim() != ''">
  159. order by ${sidx} ${order}
  160. </when>
  161. <otherwise>
  162. order by d.tick_disc_id desc
  163. </otherwise>
  164. </choose>
  165. <if test="offset != null and limit != null">
  166. limit #{offset}, #{limit}
  167. </if>
  168. </select>
  169. <select id="queryTotal" resultType="int">
  170. select count(*) from mk_store_ticket_discount d
  171. LEFT JOIN third_merchant_biz b ON d.third_merch_sn = b.third_merch_sn
  172. WHERE 1=1
  173. <if test="name != null and name.trim() != ''">
  174. AND d.name LIKE concat('%',#{name},'%')
  175. </if>
  176. <if test="storeId != null and storeId != ''">
  177. AND d.store_id = #{storeId}
  178. </if>
  179. <if test="thirdMerchSn != null and thirdMerchSn != ''">
  180. AND d.third_merch_sn = #{thirdMerchSn}
  181. </if>
  182. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
  183. AND b.third_party_merch_code = #{thirdPartyMerchCode}
  184. </if>
  185. </select>
  186. <insert id="save" parameterType="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity" useGeneratedKeys="true" keyProperty="tickDiscId">
  187. insert into mk_store_ticket_discount(
  188. `tick_disc_type`,
  189. `tick_disc_sub_title`,
  190. `merch_sn`,
  191. `third_merch_sn`,
  192. `store_id`,
  193. goods_biz_type,
  194. `store_topic_id`,
  195. `name`,
  196. `voucher_money`,
  197. `voucher_cond`,
  198. `disc_ratio`,
  199. `disc_cond`,
  200. `exch_cond`,
  201. `effect_time_type`,
  202. `fix_beg_time`,
  203. `fix_end_time`,
  204. `postpone_num`,
  205. `valid_day_num`,
  206. `ticket_num`,
  207. `apply_type`,
  208. `get_enter`,
  209. `can_share_get`,
  210. `limit_num`,
  211. `adv_img_url`,
  212. `store_logo_url`,
  213. `store_name`,
  214. `ticket_color`,
  215. `opt_decl`,
  216. `disc_decl`,
  217. `use_noti`,
  218. `svr_tel`,
  219. `is_valid`,
  220. is_past,
  221. is_store_show,
  222. disc_sell_count,
  223. disc_sell_doller,
  224. guid,
  225. `note`,
  226. `creater_sn`,
  227. `create_time`,
  228. `moder_sn`,
  229. `mod_time`,
  230. `tstm`,
  231. `send_type`)
  232. values(
  233. #{tickDiscType},
  234. #{tickDiscSubTitle},
  235. #{merchSn},
  236. #{thirdMerchSn},
  237. #{storeId},
  238. #{goodsBizType},
  239. #{storeTopicId},
  240. #{name},
  241. #{voucherMoney},
  242. #{voucherCond},
  243. #{discRatio},
  244. #{discCond},
  245. #{exchCond},
  246. #{effectTimeType},
  247. #{fixBegTime},
  248. #{fixEndTime},
  249. #{postponeNum},
  250. #{validDayNum},
  251. #{ticketNum},
  252. #{applyType},
  253. #{getEnter},
  254. #{canShareGet},
  255. #{limitNum},
  256. #{advImgUrl},
  257. #{storeLogoUrl},
  258. #{storeName},
  259. #{ticketColor},
  260. #{optDecl},
  261. #{discDecl},
  262. #{useNoti},
  263. #{svrTel},
  264. #{isValid},
  265. #{isPast},
  266. #{isStoreShow},
  267. #{discSellCount},
  268. #{discSellDoller},
  269. #{guid},
  270. #{note},
  271. #{createrSn},
  272. #{createTime},
  273. #{moderSn},
  274. #{modTime},
  275. #{tstm},
  276. #{sendType})
  277. </insert>
  278. <update id="update" parameterType="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity">
  279. update mk_store_ticket_discount
  280. <set>
  281. <if test="tickDiscType != null">`tick_disc_type` = #{tickDiscType}, </if>
  282. <if test="tickDiscSubTitle != null">`tick_disc_sub_title` = #{tickDiscSubTitle}, </if>
  283. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  284. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  285. <if test="storeId != null">`store_id` = #{storeId}, </if>
  286. <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType}, </if>
  287. <if test="storeTopicId != null">`store_topic_id` = #{storeTopicId}, </if>
  288. <if test="name != null">`name` = #{name}, </if>
  289. <if test="voucherMoney != null">`voucher_money` = #{voucherMoney}, </if>
  290. <if test="voucherCond != null">`voucher_cond` = #{voucherCond}, </if>
  291. <if test="discRatio != null">`disc_ratio` = #{discRatio}, </if>
  292. <if test="discCond != null">`disc_cond` = #{discCond}, </if>
  293. <if test="exchCond != null">`exch_cond` = #{exchCond}, </if>
  294. <if test="effectTimeType != null">`effect_time_type` = #{effectTimeType}, </if>
  295. <if test="fixBegTime != null">`fix_beg_time` = #{fixBegTime}, </if>
  296. <if test="fixEndTime != null">`fix_end_time` = #{fixEndTime}, </if>
  297. <if test="postponeNum != null">`postpone_num` = #{postponeNum}, </if>
  298. <if test="validDayNum != null">`valid_day_num` = #{validDayNum}, </if>
  299. <if test="ticketNum != null">`ticket_num` = #{ticketNum}, </if>
  300. <if test="applyType != null">`apply_type` = #{applyType}, </if>
  301. <if test="getEnter != null">`get_enter` = #{getEnter}, </if>
  302. <if test="canShareGet != null">`can_share_get` = #{canShareGet}, </if>
  303. <if test="limitNum != null">`limit_num` = #{limitNum}, </if>
  304. <if test="advImgUrl != null">`adv_img_url` = #{advImgUrl}, </if>
  305. <if test="storeLogoUrl != null">`store_logo_url` = #{storeLogoUrl}, </if>
  306. <if test="storeName != null">`store_name` = #{storeName}, </if>
  307. <if test="ticketColor != null">`ticket_color` = #{ticketColor}, </if>
  308. <if test="optDecl != null">`opt_decl` = #{optDecl}, </if>
  309. <if test="discDecl != null">`disc_decl` = #{discDecl}, </if>
  310. <if test="useNoti != null">`use_noti` = #{useNoti}, </if>
  311. <if test="svrTel != null">`svr_tel` = #{svrTel}, </if>
  312. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  313. <if test="isPast != null">`is_past` = #{isPast}, </if>
  314. <if test="isStoreShow != null">`is_store_show` = #{isStoreShow}, </if>
  315. <if test="discSellCount != null">`disc_sell_count` = #{discSellCount}, </if>
  316. <if test="discSellDoller != null">`disc_sell_doller` = #{discSellDoller}, </if>
  317. <if test="guid != null">`guid` = #{guid}, </if>
  318. <if test="note != null">`note` = #{note}, </if>
  319. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  320. <if test="createTime != null">`create_time` = #{createTime}, </if>
  321. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  322. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  323. <if test="tstm != null">`tstm` = #{tstm}, </if>
  324. <if test="sendType != null">`send_type` = #{sendType}</if>
  325. </set>
  326. where tick_disc_id = #{tickDiscId}
  327. </update>
  328. <delete id="delete">
  329. delete from mk_store_ticket_discount where tick_disc_id = #{value}
  330. </delete>
  331. <delete id="deleteBatch">
  332. delete from mk_store_ticket_discount where tick_disc_id in
  333. <foreach item="tickDiscId" collection="array" open="(" separator="," close=")">
  334. #{tickDiscId}
  335. </foreach>
  336. </delete>
  337. <select id="queryByGoodsId" resultType="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity">
  338. select distinct
  339. mktd.tick_disc_id,
  340. mktd.tick_disc_type,
  341. mktd.tick_disc_sub_title,
  342. mktd.merch_sn,
  343. mktd.third_merch_sn,
  344. mktd.store_id,
  345. mktd.goods_biz_type,
  346. mktd.is_store_show,
  347. mktd.store_topic_id,
  348. mktd.name,
  349. mktd.voucher_money,
  350. mktd.voucher_cond,
  351. mktd.disc_ratio,
  352. mktd.disc_cond,
  353. mktd.exch_cond,
  354. mktd.effect_time_type,
  355. mktd.fix_beg_time,
  356. mktd.fix_end_time,
  357. mktd.postpone_num,
  358. mktd.valid_day_num,
  359. mktd.ticket_num,
  360. mktd.apply_type,
  361. mktd.get_enter,
  362. mktd.can_share_get,
  363. mktd.limit_num,
  364. mktd.adv_img_url,
  365. mktd.store_logo_url,
  366. mktd.store_name,
  367. mktd.ticket_color,
  368. mktd.opt_decl,
  369. mktd.disc_decl,
  370. mktd.use_noti,
  371. mktd.svr_tel,
  372. mktd.is_valid,
  373. mktd.is_past,
  374. mktd.disc_sell_count,
  375. mktd.disc_sell_doller,
  376. mktd.note,
  377. mktd.creater_sn,
  378. mktd.create_time,
  379. mktd.moder_sn,
  380. mktd.mod_time,
  381. mktd.tstm,
  382. mktd.send_type,
  383. mktd.guid
  384. from mk_store_ticket_discount mktd
  385. left join mk_store_ticket_discount_goods mstdg on mstdg.tick_disc_id = mktd.tick_disc_id
  386. left join mall_product_store_rela rela on mstdg.store_rela_id = rela.id
  387. where rela.goods_id = #{goodsId} and mktd.fix_beg_time &lt; now() and mktd.fix_end_time &gt; now() and mktd.apply_type != '02'
  388. </select>
  389. <select id="queryByStoreId" resultType="com.kmall.admin.entity.mk.store.MkStoreTicketDiscountEntity">
  390. select distinct
  391. `mktd.tick_disc_id`,
  392. `mktd.tick_disc_type`,
  393. `mktd.tick_disc_sub_title`,
  394. `mktd.merch_sn`,
  395. `mktd.third_merch_sn`,
  396. `mktd.store_id`,goods_biz_type,is_store_show,
  397. `mktd.store_topic_id`,
  398. `mktd.name`,
  399. `mktd.voucher_money`,
  400. `mktd.voucher_cond`,
  401. `mktd.disc_ratio`,
  402. `mktd.disc_cond`,
  403. `mktd.exch_cond`,
  404. `mktd.effect_time_type`,
  405. `mktd.fix_beg_time`,
  406. `mktd.fix_end_time`,
  407. `mktd.postpone_num`,
  408. `mktd.valid_day_num`,
  409. `mktd.ticket_num`,
  410. `mktd.apply_type`,
  411. `mktd.get_enter`,
  412. `mktd.can_share_get`,
  413. `mktd.limit_num`,
  414. `mktd.adv_img_url`,
  415. `mktd.store_logo_url`,
  416. `mktd.store_name`,
  417. `mktd.ticket_color`,
  418. `mktd.opt_decl`,
  419. `mktd.disc_decl`,
  420. `mktd.use_noti`,
  421. `mktd.svr_tel`,
  422. `mktd.is_valid`,
  423. mktd.is_past,
  424. mktd.disc_sell_count,
  425. mktd.disc_sell_doller,
  426. `mktd.note`,
  427. `mktd.creater_sn`,
  428. `mktd.create_time`,
  429. `mktd.moder_sn`,
  430. `mktd.mod_time`,
  431. `mktd.tstm`,
  432. `mktd.send_type`,
  433. mktd.guid
  434. from mk_store_ticket_discount mktd
  435. where mktd.store_id = #{storeId}
  436. </select>
  437. </mapper>