You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

702 lines
23 KiB

  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.iformall.mapper.WxCouponMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCoupon">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="type" jdbcType="INTEGER" property="type"/>
  8. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  9. <result column="title" jdbcType="VARCHAR" property="title"/>
  10. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  11. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  12. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  13. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
  14. <result column="send_type" jdbcType="INTEGER" property="sendType"/>
  15. <result column="valid_type" jdbcType="INTEGER" property="validType"/>
  16. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  17. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  18. <result column="valid_days" jdbcType="INTEGER" property="validDays"/>
  19. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  20. <result column="price" jdbcType="INTEGER" property="price"/>
  21. <result column="unit" jdbcType="INTEGER" property="unit"/>
  22. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
  23. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  24. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  25. <result column="status" jdbcType="INTEGER" property="status"/>
  26. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  27. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  28. <result column="business" jdbcType="INTEGER" property="business"/>
  29. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  30. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  31. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  32. <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
  33. <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
  34. <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/>
  35. <result column="sale_count" property="saleCount"/>
  36. <result column="transfer_count" property="transferCount"/>
  37. <result column="sale_amount" property="saleAmount"/>
  38. <result column="sum_payment" property="sumPayment"/>
  39. </resultMap>
  40. <sql id="allColumns">
  41. `id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,
  42. `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,
  43. `remark`,`status`,`create_date`,`update_date`,`business`,`support_transfer`,`subsidy_num`,`subsidy_type`,
  44. `press_limit_num`, `press_limit_hours`, `auto_refund`
  45. </sql>
  46. <sql id="dynamicWhereConditions">
  47. where 1 = 1
  48. <if test=" null != id ">
  49. and `id` = #{id}
  50. </if>
  51. <if test=" null != tenantId ">
  52. and `tenant_id` = #{tenantId}
  53. </if>
  54. <if test=" null != type ">
  55. and `type` = #{type}
  56. </if>
  57. <if test=" null != coverImg ">
  58. and `cover_img` like concat('%', #{coverImg},'%')
  59. </if>
  60. <if test=" null != title and ''!=title">
  61. and `title` like concat('%', #{title},'%')
  62. </if>
  63. <if test=" null != subTitle ">
  64. and `sub_title` like concat('%', #{subTitle},'%')
  65. </if>
  66. <if test=" null != salePrice ">
  67. and `sale_price` = #{salePrice}
  68. </if>
  69. <if test=" null != usePrice ">
  70. and `use_price` = #{usePrice}
  71. </if>
  72. <if test=" null != useLimitQuantity ">
  73. and `use_limit_quantity` = #{useLimitQuantity}
  74. </if>
  75. <if test=" null != sendType ">
  76. and `send_type` = #{sendType}
  77. </if>
  78. <if test=" null != validType ">
  79. and `valid_type` = #{validType}
  80. </if>
  81. <if test=" null != validStartDate ">
  82. and `valid_start_date` = #{validStartDate}
  83. </if>
  84. <if test=" null != validEndDate ">
  85. and `valid_end_date` = #{validEndDate}
  86. </if>
  87. <if test=" null != validDays ">
  88. and `valid_days` = #{validDays}
  89. </if>
  90. <if test=" null != detail ">
  91. and `detail` like concat('%', #{detail},'%')
  92. </if>
  93. <if test=" null != price ">
  94. and `price` = #{price}
  95. </if>
  96. <if test=" null != unit ">
  97. and `unit` = #{unit}
  98. </if>
  99. <if test=" null != remainInventory ">
  100. and `remain_inventory` = #{remainInventory}
  101. </if>
  102. <if test=" null != inventory ">
  103. and `inventory` = #{inventory}
  104. </if>
  105. <if test=" null != remark ">
  106. and `remark` like concat('%', #{remark},'%')
  107. </if>
  108. <if test=" null != status">
  109. and `status` = #{status}
  110. </if>
  111. <if test=" null != startdate and null!=enddate">
  112. and `create_date` between #{startdate} and #{enddate}
  113. </if>
  114. <if test=" null != updateDate ">
  115. and `update_date` = #{updateDate}
  116. </if>
  117. <if test=" null != business ">
  118. and `business` = #{business}
  119. </if>
  120. <if test=" null != supportTransfer ">
  121. and `support_transfer` = #{supportTransfer}
  122. </if>
  123. <if test=" null != subsidyType ">
  124. and `subsidy_type` = #{subsidyType}
  125. </if>
  126. <if test=" null != subsidyNum ">
  127. and `subsidy_num` = #{subsidyNum}
  128. </if>
  129. <if test=" null != pressLimitNum ">
  130. and `press_limit_num` = #{pressLimitNum}
  131. </if>
  132. <if test=" null != pressLimitHours ">
  133. and `press_limit_hours` = #{pressLimitHours}
  134. </if>
  135. <if test=" null != autoRefund ">
  136. and `auto_refund` = #{autoRefund}
  137. </if>
  138. <if test=" null != ids ">
  139. and id in
  140. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  141. #{idItem}
  142. </foreach>
  143. </if>
  144. <if test=" null != sortColumns">order by ${sortColumns}</if>
  145. </sql>
  146. <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  147. select
  148. <include refid="allColumns"/>
  149. from wx_coupon
  150. <include refid="dynamicWhereConditions"/>
  151. </select>
  152. <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  153. select <include refid="allColumns"/>,
  154. (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
  155. (select count(distinct wcs.coupon_order_id) from wx_card_info ci
  156. left join wx_coupon wc on wc.id = ci.coupon_id
  157. left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
  158. where wc.id = c.id) as transfer_count,
  159. (select sum(ci.sale_amount) from wx_card_info ci
  160. left join wx_coupon wc on wc.id = ci.coupon_id
  161. where wc.id = c.id) as sale_amount,
  162. (select sum(wcs.real_payment) from wx_card_info ci
  163. left join wx_coupon wc on wc.id = ci.coupon_id
  164. left join wx_card_spend wcs on wcs.card_id = ci.id
  165. where wc.id = c.id) as sum_payment
  166. from wx_coupon c where 1=1
  167. <if test=" null != title ">
  168. and `title` like concat('%', #{title},'%')
  169. </if>
  170. order by status asc,create_date desc
  171. </select>
  172. <sql id="dynamicWhereConditionsForCard">
  173. where `type` = 100
  174. <if test=" null != id ">
  175. and `id` = #{id}
  176. </if>
  177. <if test=" null != tenantId ">
  178. and `tenant_id` = #{tenantId}
  179. </if>
  180. <if test=" null != type ">
  181. and `type` = #{type}
  182. </if>
  183. <if test=" null != coverImg ">
  184. and `cover_img` like concat('%', #{coverImg},'%')
  185. </if>
  186. <if test=" null != title and ''!=title">
  187. and `title` like concat('%', #{title},'%')
  188. </if>
  189. <if test=" null != subTitle ">
  190. and `sub_title` like concat('%', #{subTitle},'%')
  191. </if>
  192. <if test=" null != salePrice ">
  193. and `sale_price` = #{salePrice}
  194. </if>
  195. <if test=" null != usePrice ">
  196. and `use_price` = #{usePrice}
  197. </if>
  198. <if test=" null != useLimitQuantity ">
  199. and `use_limit_quantity` = #{useLimitQuantity}
  200. </if>
  201. <if test=" null != sendType ">
  202. and `send_type` = #{sendType}
  203. </if>
  204. <if test=" null != validType ">
  205. and `valid_type` = #{validType}
  206. </if>
  207. <if test=" null != validStartDate ">
  208. and `valid_start_date` = #{validStartDate}
  209. </if>
  210. <if test=" null != validEndDate ">
  211. and `valid_end_date` = #{validEndDate}
  212. </if>
  213. <if test=" null != validDays ">
  214. and `valid_days` = #{validDays}
  215. </if>
  216. <if test=" null != detail ">
  217. and `detail` like concat('%', #{detail},'%')
  218. </if>
  219. <if test=" null != price ">
  220. and `price` = #{price}
  221. </if>
  222. <if test=" null != unit ">
  223. and `unit` = #{unit}
  224. </if>
  225. <if test=" null != remainInventory ">
  226. and `remain_inventory` = #{remainInventory}
  227. </if>
  228. <if test=" null != inventory ">
  229. and `inventory` = #{inventory}
  230. </if>
  231. <if test=" null != remark ">
  232. and `remark` like concat('%', #{remark},'%')
  233. </if>
  234. <if test=" null != status">
  235. and `status` = #{status}
  236. </if>
  237. <if test=" null != startdate and null!=enddate">
  238. and `create_date` between #{startdate} and #{enddate}
  239. </if>
  240. <if test=" null != updateDate ">
  241. and `update_date` = #{updateDate}
  242. </if>
  243. <if test=" null != business ">
  244. and `business` = #{business}
  245. </if>
  246. <if test=" null != supportTransfer ">
  247. and `support_transfer` = #{supportTransfer}
  248. </if>
  249. <if test=" null != subsidyType ">
  250. and `subsidy_type` = #{subsidyType}
  251. </if>
  252. <if test=" null != subsidyNum ">
  253. and `subsidy_num` = #{subsidyNum}
  254. </if>
  255. <if test=" null != pressLimitNum ">
  256. and `press_limit_num` = #{pressLimitNum}
  257. </if>
  258. <if test=" null != pressLimitHours ">
  259. and `press_limit_hours` = #{pressLimitHours}
  260. </if>
  261. <if test=" null != ids ">
  262. and id in
  263. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  264. #{idItem}
  265. </foreach>
  266. </if>
  267. <if test=" null != sortColumns">order by ${sortColumns}</if>
  268. </sql>
  269. <select id="findCardList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  270. select
  271. <include refid="allColumns"/>
  272. from wx_coupon
  273. <include refid="dynamicWhereConditionsForCard"/>
  274. </select>
  275. <sql id="dynamicWhereConditionsForCoupon">
  276. where `type` &lt; 7
  277. <if test=" null != id ">
  278. and `id` = #{id}
  279. </if>
  280. <if test=" null != tenantId ">
  281. and `tenant_id` = #{tenantId}
  282. </if>
  283. <if test=" null != type ">
  284. and `type` = #{type}
  285. </if>
  286. <if test=" null != coverImg ">
  287. and `cover_img` like concat('%', #{coverImg},'%')
  288. </if>
  289. <if test=" null != title and ''!=title">
  290. and `title` like concat('%', #{title},'%')
  291. </if>
  292. <if test=" null != subTitle ">
  293. and `sub_title` like concat('%', #{subTitle},'%')
  294. </if>
  295. <if test=" null != salePrice ">
  296. and `sale_price` = #{salePrice}
  297. </if>
  298. <if test=" null != usePrice ">
  299. and `use_price` = #{usePrice}
  300. </if>
  301. <if test=" null != useLimitQuantity ">
  302. and `use_limit_quantity` = #{useLimitQuantity}
  303. </if>
  304. <if test=" null != sendType ">
  305. and `send_type` = #{sendType}
  306. </if>
  307. <if test=" null != validType ">
  308. and `valid_type` = #{validType}
  309. </if>
  310. <if test=" null != validStartDate ">
  311. and `valid_start_date` = #{validStartDate}
  312. </if>
  313. <if test=" null != validEndDate ">
  314. and `valid_end_date` = #{validEndDate}
  315. </if>
  316. <if test=" null != validDays ">
  317. and `valid_days` = #{validDays}
  318. </if>
  319. <if test=" null != detail ">
  320. and `detail` like concat('%', #{detail},'%')
  321. </if>
  322. <if test=" null != price ">
  323. and `price` = #{price}
  324. </if>
  325. <if test=" null != unit ">
  326. and `unit` = #{unit}
  327. </if>
  328. <if test=" null != remainInventory ">
  329. and `remain_inventory` = #{remainInventory}
  330. </if>
  331. <if test=" null != inventory ">
  332. and `inventory` = #{inventory}
  333. </if>
  334. <if test=" null != remark ">
  335. and `remark` like concat('%', #{remark},'%')
  336. </if>
  337. <if test=" null != status">
  338. and `status` = #{status}
  339. </if>
  340. <if test=" null != startdate and null!=enddate">
  341. and `create_date` between #{startdate} and #{enddate}
  342. </if>
  343. <if test=" null != updateDate ">
  344. and `update_date` = #{updateDate}
  345. </if>
  346. <if test=" null != business ">
  347. and `business` = #{business}
  348. </if>
  349. <if test=" null != supportTransfer ">
  350. and `support_transfer` = #{supportTransfer}
  351. </if>
  352. <if test=" null != subsidyType ">
  353. and `subsidy_type` = #{subsidyType}
  354. </if>
  355. <if test=" null != subsidyNum ">
  356. and `subsidy_num` = #{subsidyNum}
  357. </if>
  358. <if test=" null != pressLimitNum ">
  359. and `press_limit_num` = #{pressLimitNum}
  360. </if>
  361. <if test=" null != pressLimitHours ">
  362. and `press_limit_hours` = #{pressLimitHours}
  363. </if>
  364. <if test=" null != ids ">
  365. and id in
  366. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  367. #{idItem}
  368. </foreach>
  369. </if>
  370. <if test=" null != sortColumns">order by ${sortColumns}</if>
  371. </sql>
  372. <select id="findCouponList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  373. select
  374. <include refid="allColumns"/>
  375. from wx_coupon
  376. <include refid="dynamicWhereConditionsForCoupon"/>
  377. </select>
  378. <sql id="dynamicWhereConditionsForPress">
  379. where `type` = 8
  380. <if test=" null != id ">
  381. and `id` = #{id}
  382. </if>
  383. <if test=" null != tenantId ">
  384. and `tenant_id` = #{tenantId}
  385. </if>
  386. <if test=" null != type ">
  387. and `type` = #{type}
  388. </if>
  389. <if test=" null != coverImg ">
  390. and `cover_img` like concat('%', #{coverImg},'%')
  391. </if>
  392. <if test=" null != title and ''!=title">
  393. and `title` like concat('%', #{title},'%')
  394. </if>
  395. <if test=" null != subTitle ">
  396. and `sub_title` like concat('%', #{subTitle},'%')
  397. </if>
  398. <if test=" null != salePrice ">
  399. and `sale_price` = #{salePrice}
  400. </if>
  401. <if test=" null != usePrice ">
  402. and `use_price` = #{usePrice}
  403. </if>
  404. <if test=" null != useLimitQuantity ">
  405. and `use_limit_quantity` = #{useLimitQuantity}
  406. </if>
  407. <if test=" null != sendType ">
  408. and `send_type` = #{sendType}
  409. </if>
  410. <if test=" null != validType ">
  411. and `valid_type` = #{validType}
  412. </if>
  413. <if test=" null != validStartDate ">
  414. and `valid_start_date` = #{validStartDate}
  415. </if>
  416. <if test=" null != validEndDate ">
  417. and `valid_end_date` = #{validEndDate}
  418. </if>
  419. <if test=" null != validDays ">
  420. and `valid_days` = #{validDays}
  421. </if>
  422. <if test=" null != detail ">
  423. and `detail` like concat('%', #{detail},'%')
  424. </if>
  425. <if test=" null != price ">
  426. and `price` = #{price}
  427. </if>
  428. <if test=" null != unit ">
  429. and `unit` = #{unit}
  430. </if>
  431. <if test=" null != remainInventory ">
  432. and `remain_inventory` = #{remainInventory}
  433. </if>
  434. <if test=" null != inventory ">
  435. and `inventory` = #{inventory}
  436. </if>
  437. <if test=" null != remark ">
  438. and `remark` like concat('%', #{remark},'%')
  439. </if>
  440. <if test=" null != status">
  441. and `status` = #{status}
  442. </if>
  443. <if test=" null != startdate and null!=enddate">
  444. and `create_date` between #{startdate} and #{enddate}
  445. </if>
  446. <if test=" null != updateDate ">
  447. and `update_date` = #{updateDate}
  448. </if>
  449. <if test=" null != business ">
  450. and `business` = #{business}
  451. </if>
  452. <if test=" null != supportTransfer ">
  453. and `support_transfer` = #{supportTransfer}
  454. </if>
  455. <if test=" null != subsidyType ">
  456. and `subsidy_type` = #{subsidyType}
  457. </if>
  458. <if test=" null != subsidyNum ">
  459. and `subsidy_num` = #{subsidyNum}
  460. </if>
  461. <if test=" null != pressLimitNum ">
  462. and `press_limit_num` = #{pressLimitNum}
  463. </if>
  464. <if test=" null != pressLimitHours ">
  465. and `press_limit_hours` = #{pressLimitHours}
  466. </if>
  467. <if test=" null != ids ">
  468. and id in
  469. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  470. #{idItem}
  471. </foreach>
  472. </if>
  473. <if test=" null != sortColumns">order by ${sortColumns}</if>
  474. </sql>
  475. <select id="findPressList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
  476. select
  477. <include refid="allColumns"/>
  478. from wx_coupon
  479. <include refid="dynamicWhereConditionsForPress"/>
  480. </select>
  481. <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo">
  482. <id column="id" jdbcType="BIGINT" property="id"/>
  483. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  484. <result column="type" jdbcType="INTEGER" property="type"/>
  485. <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
  486. <result column="title" jdbcType="VARCHAR" property="title"/>
  487. <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
  488. <result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
  489. <result column="use_price" jdbcType="INTEGER" property="usePrice"/>
  490. <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
  491. <result column="send_type" jdbcType="INTEGER" property="sendType"/>
  492. <result column="valid_type" jdbcType="INTEGER" property="validType"/>
  493. <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
  494. <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
  495. <result column="valid_days" jdbcType="INTEGER" property="validDays"/>
  496. <result column="detail" jdbcType="VARCHAR" property="detail"/>
  497. <result column="price" jdbcType="INTEGER" property="price"/>
  498. <result column="unit" jdbcType="INTEGER" property="unit"/>
  499. <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
  500. <result column="inventory" jdbcType="INTEGER" property="inventory"/>
  501. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  502. <result column="status" jdbcType="INTEGER" property="status"/>
  503. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  504. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  505. <result column="business" jdbcType="INTEGER" property="business"/>
  506. <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
  507. <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
  508. <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
  509. <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
  510. <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
  511. <collection column="{productId=id}" property="merchantVoList"
  512. ofType="com.iformall.domain.vo.WxMerchantVo"
  513. javaType="java.util.List"
  514. select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantBaseList" >
  515. </collection>
  516. </resultMap>
  517. <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap">
  518. select
  519. <include refid="allColumns"/>
  520. from wx_coupon
  521. where id = #{id}
  522. </select>
  523. <update id="reduceInventory">
  524. update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number}
  525. </update>
  526. <update id="offExpiriedCouponByValidDate">
  527. update wx_coupon SET status = 1, update_date = now()
  528. where status = 0 and valid_type = 1 and valid_end_date &lt; now()
  529. </update>
  530. <update id="offExpiriedCouponByMerchantStatus">
  531. update wx_coupon c
  532. SET c.status = 1, c.update_date = now()
  533. where c.status = 0 and
  534. (select count(*) from wx_coupon_merchant cm, wx_merchant m
  535. where m.id = cm.merchant_id
  536. and c.id = cm.product_id
  537. and cm.status = 0
  538. and m.status = 1) = 0
  539. </update>
  540. <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
  541. select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) sale_amount from wx_card_info ci
  542. left join wx_coupon c on c.id = ci.coupon_id
  543. where ci.create_date between #{startdate} and #{enddate}
  544. <if test="title != null">
  545. and c.title like concat('%', #{title},'%')
  546. </if>
  547. group by xtime
  548. </select>
  549. <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
  550. select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.real_payment) sum_payment from wx_card_info ci
  551. left join wx_coupon c on c.id = ci.coupon_id
  552. left join wx_card_spend wcs on wcs.card_id = ci.id
  553. where ci.create_date between #{startdate} and #{enddate}
  554. <if test="title != null">
  555. and c.title like concat('%', #{title},'%')
  556. </if>
  557. group by xtime
  558. </select>
  559. </mapper>