| @@ -730,17 +730,18 @@ | |||
| left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | |||
| where wc.id = c.id) as transfer_count, | |||
| (select sum(ci.sale_amount) from wx_card_info ci | |||
| (select sum(ci.sale_amount/100) from wx_card_info ci | |||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||
| where wc.id = c.id) as sale_amount, | |||
| (select sum(wcs.payment) from wx_card_info ci | |||
| (select sum(wcs.deduction_amount/100) from wx_card_info ci | |||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||
| left join wx_card_spend wcs on wcs.card_id = ci.id | |||
| 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 | |||
| (select sum(sc.subsidy) from wx_card_info ci | |||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id | |||
| where wc.id = c.id) as sum_subsidy | |||
| from wx_coupon c where c.type = 100 | |||
| @@ -755,9 +756,11 @@ | |||
| (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 | |||
| (select sum(sc.subsidy/100) from wx_coupon wc | |||
| left join wx_coupon_order wo on wo.coupon_id = wc.id | |||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id | |||
| where wc.id = c.id) as sum_subsidy | |||
| from wx_coupon c where c.type not in(8,9,100) | |||
| <if test=" 1 == type "> | |||
| and c.sale_price > 0 | |||
| @@ -777,9 +780,11 @@ | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| where wop.first = 1 and wc.id = c.id) as press_count, | |||
| (select count(wo.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| where wo.order_status = 7 and wc.id = c.id) as press_succ_count, | |||
| (select count(wop.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| @@ -795,11 +800,7 @@ | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| where wop.first = 1 and wc.id = c.id) | |||
| *100,2) as payment_rate, | |||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| where wo.order_status = 7 and wc.id = c.id) as sum_subsidy | |||
| *100,2) as payment_rate | |||
| from wx_coupon c where c.type = 8 | |||
| <if test="id != null"> | |||
| @@ -859,13 +860,13 @@ | |||
| </select> | |||
| <select id="findSumPriceSaleMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select sum(wco.coupon_price) from wx_coupon c,wx_coupon_order wco | |||
| select sum(wco.coupon_price/100) from wx_coupon c,wx_coupon_order wco | |||
| where wco.coupon_id = c.id and wco.coupon_price > 0 | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| </select> | |||
| <select id="findSumPricePayMent" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select sum(wco.coupon_price) from wx_coupon c,wx_coupon_order wco | |||
| select sum(c.price/100) from wx_coupon c,wx_coupon_order wco | |||
| where wco.coupon_id = c.id and wco.coupon_price > 0 and wco.coupon_order_status = 1 | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| </select> | |||