| @@ -715,31 +715,43 @@ | |||||
| <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select c.*, | select c.*, | ||||
| (select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | |||||
| (select sum(wco.id) from wx_coupon wc | |||||
| left join wx_coupon_order wco on wc.id = wco.coupon_id | |||||
| where wc.id = c.id) as sale_count, | |||||
| (select count(distinct wcs.coupon_order_id) from wx_card_info ci | (select count(distinct wcs.coupon_order_id) from wx_card_info ci | ||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | ||||
| where wc.id = c.id) as transfer_count, | where wc.id = c.id) as transfer_count, | ||||
| (select sum(ci.sale_amount) from wx_card_info ci | (select sum(ci.sale_amount) from wx_card_info ci | ||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| where wc.id = c.id) as sale_amount, | where wc.id = c.id) as sale_amount, | ||||
| (select sum(wcs.payment) from wx_card_info ci | (select sum(wcs.payment) from wx_card_info ci | ||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| left join wx_card_spend wcs on wcs.card_id = ci.id | left join wx_card_spend wcs on wcs.card_id = ci.id | ||||
| where c.type = 100 | |||||
| and wc.id = c.id) as sum_payment | |||||
| from wx_coupon c where 1=1 | |||||
| where wc.id = c.id) as sum_payment, | |||||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||||
| left join wx_coupon_order wco on wc.id = wco.coupon_id | |||||
| where wc.id = c.id) as sum_subsidy | |||||
| from wx_coupon c where c.type = 100 | |||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| </if> | </if> | ||||
| order by status asc,create_date desc | |||||
| order by c.status asc,c.create_date desc | |||||
| </select> | </select> | ||||
| <select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select c.*, | select c.*, | ||||
| (select count(distinct wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | |||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count, | |||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count | |||||
| (select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | |||||
| (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count, | |||||
| (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count, | |||||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||||
| left join wx_coupon_order wco on wc.id = wco.coupon_id | |||||
| where wc.id = c.id) as sum_subsidy | |||||
| from wx_coupon c where c.type not in(8,9,100) | from wx_coupon c where c.type not in(8,9,100) | ||||
| <if test=" 1 == type "> | <if test=" 1 == type "> | ||||
| and c.sale_price > 0 | and c.sale_price > 0 | ||||
| @@ -750,7 +762,7 @@ | |||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| </if> | </if> | ||||
| order by status asc,create_date desc | |||||
| order by c.status asc,c.create_date desc | |||||
| </select> | </select> | ||||
| <select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| @@ -787,7 +799,7 @@ | |||||
| <if test="id != null"> | <if test="id != null"> | ||||
| and c.id = #{id} | and c.id = #{id} | ||||
| </if> | </if> | ||||
| order by status asc,create_date desc | |||||
| order by c.status asc,c.create_date desc | |||||
| </select> | </select> | ||||
| <!-- | <!-- | ||||