| | |
| | | |
| | | <select id="chargingOrderShareIncomeByOrderIds" resultType="map"> |
| | | select |
| | | charging_order_id as orderId, |
| | | sum(IFNULL(channel_pay_amount, 0) - IFNULL(share_amount, 0)) as platformIncome, |
| | | sum(IFNULL(share_amount, 0)) as partnerIncome |
| | | from `charging_pile_order`.t_charging_order_share_record |
| | | where del_flag = 0 and charging_order_id is not null |
| | | s.charging_order_id as orderId, |
| | | sum(IFNULL(s.channel_pay_amount, 0) - IFNULL(s.share_amount, 0)) as platformIncome, |
| | | sum(IFNULL(s.share_amount, 0)) as partnerIncome |
| | | from `charging_pile_order`.t_charging_order_share_record s |
| | | inner join `charging_pile_order`.t_charging_order o on o.id = s.charging_order_id |
| | | where s.del_flag = 0 and s.charging_order_id is not null |
| | | and IFNULL(o.third_refund_amount, CASE WHEN o.pay_method = 3 THEN IFNULL(o.refund_amount, 0) ELSE 0 END) |
| | | < IFNULL(s.channel_pay_amount, 0) |
| | | <if test="orderIds != null and orderIds.size()>0"> |
| | | and charging_order_id in |
| | | and s.charging_order_id in |
| | | <foreach collection="orderIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | group by charging_order_id |
| | | group by s.charging_order_id |
| | | </select> |
| | | |
| | | <select id="chargingOrderShareIncomeByPayChannel" resultType="map"> |
| | |
| | | and o.del_flag = 0 |
| | | and o.recharge_payment_status = 2 |
| | | and o.status = 5 |
| | | and IFNULL(o.third_refund_amount, CASE WHEN o.pay_method = 3 THEN IFNULL(o.refund_amount, 0) ELSE 0 END) |
| | | < IFNULL(s.channel_pay_amount, 0) |
| | | <if test="sixBefore != null"> |
| | | and o.create_time >= #{sixBefore} |
| | | </if> |
| | |
| | | |
| | | <select id="chargingOrderShareIncomeSummaryByOrderIds" resultType="map"> |
| | | select |
| | | sum(IFNULL(channel_pay_amount, 0) - IFNULL(share_amount, 0)) as platformIncomeTotal, |
| | | sum(IFNULL(share_amount, 0)) as partnerIncomeTotal |
| | | from `charging_pile_order`.t_charging_order_share_record |
| | | where del_flag = 0 and charging_order_id is not null |
| | | sum(IFNULL(s.channel_pay_amount, 0) - IFNULL(s.share_amount, 0)) as platformIncomeTotal, |
| | | sum(IFNULL(s.share_amount, 0)) as partnerIncomeTotal |
| | | from `charging_pile_order`.t_charging_order_share_record s |
| | | inner join `charging_pile_order`.t_charging_order o on o.id = s.charging_order_id |
| | | where s.del_flag = 0 and s.charging_order_id is not null |
| | | and IFNULL(o.third_refund_amount, CASE WHEN o.pay_method = 3 THEN IFNULL(o.refund_amount, 0) ELSE 0 END) |
| | | < IFNULL(s.channel_pay_amount, 0) |
| | | <if test="orderIds != null and orderIds.size()>0"> |
| | | and charging_order_id in |
| | | and s.charging_order_id in |
| | | <foreach collection="orderIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |