| @@ -429,11 +429,11 @@ | |||||
| ifnull(consume.consumeCount,0) consumeCount,ifnull(consume.consumeCountP,0) as consumeCountP, | ifnull(consume.consumeCount,0) consumeCount,ifnull(consume.consumeCountP,0) as consumeCountP, | ||||
| ifnull(consume.tradeAmt,0) tradeAmt | ifnull(consume.tradeAmt,0) tradeAmt | ||||
| FROM wx_merchant m | FROM wx_merchant m | ||||
| left join (select count(co.c_user_id) AS consumeCount, | |||||
| count(DISTINCT co.c_user_id) AS consumeCountP,sum(co.coupon_price) AS tradeAmt, m.id as merchant_id from | |||||
| left join (select count(co.c_user_id) AS consumeCountP, | |||||
| count(DISTINCT co.c_user_id) AS consumeCount,sum(co.coupon_price) AS tradeAmt, m.id as merchant_id from | |||||
| wx_coupon_order co | wx_coupon_order co | ||||
| left join (select m.id,mbu.id as b_user_id from wx_merchant m | left join (select m.id,mbu.id as b_user_id from wx_merchant m | ||||
| left join wx_merchant_b_user mbu on m.id=mbu.merchant_id) m | |||||
| left join wx_merchant_b_user mbu on m.id=mbu.merchant_id where status=0) m | |||||
| on co.b_user_id=m.b_user_id | on co.b_user_id=m.b_user_id | ||||
| WHERE co.coupon_order_status = 1 | WHERE co.coupon_order_status = 1 | ||||
| <if test="tenantId != null"> | <if test="tenantId != null"> | ||||
| @@ -471,7 +471,7 @@ | |||||
| and o.tenant_id=#{tenantId} | and o.tenant_id=#{tenantId} | ||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and o.b_user_id in( | and o.b_user_id in( | ||||
| select id from wx_merchant_b_user where merchant_id=#{id} | |||||
| select id from wx_merchant_b_user where status=0 and merchant_id=#{id} | |||||
| ) | ) | ||||
| </if> | </if> | ||||