| | |
| | | <select id="chargingOrderShareIncomeByOrderIds" resultType="map"> |
| | | select |
| | | 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 |
| | | sum( |
| | | IFNULL(s.channel_pay_amount, 0) |
| | | - IFNULL(o.third_refund_amount, CASE WHEN o.pay_method = 3 THEN IFNULL(o.refund_amount, 0) ELSE 0 END) |
| | | - IFNULL(s.share_amount, 0) |
| | | * (IFNULL(s.channel_pay_amount, 0) |
| | | - 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) |
| | | ) as platformIncome, |
| | | sum( |
| | | IFNULL(s.share_amount, 0) |
| | | * (IFNULL(s.channel_pay_amount, 0) |
| | | - 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) |
| | | ) 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 |
| | |
| | | <select id="chargingOrderShareIncomeByPayChannel" resultType="map"> |
| | | select |
| | | s.pay_channel as payChannel, |
| | | sum(IFNULL(s.share_amount, 0)) as shareAmount |
| | | sum( |
| | | IFNULL(s.share_amount, 0) |
| | | * (IFNULL(s.channel_pay_amount, 0) |
| | | - 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) |
| | | ) as shareAmount |
| | | from t_charging_order_share_record s |
| | | inner join t_charging_order o on s.charging_order_id = o.id |
| | | where s.del_flag = 0 |
| | |
| | | |
| | | <select id="chargingOrderShareIncomeSummaryByOrderIds" resultType="map"> |
| | | select |
| | | sum(IFNULL(s.channel_pay_amount, 0) - IFNULL(s.share_amount, 0)) as platformIncomeTotal, |
| | | sum(IFNULL(s.share_amount, 0)) as partnerIncomeTotal |
| | | sum( |
| | | IFNULL(s.channel_pay_amount, 0) |
| | | - IFNULL(o.third_refund_amount, CASE WHEN o.pay_method = 3 THEN IFNULL(o.refund_amount, 0) ELSE 0 END) |
| | | - IFNULL(s.share_amount, 0) |
| | | * (IFNULL(s.channel_pay_amount, 0) |
| | | - 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) |
| | | ) as platformIncomeTotal, |
| | | sum( |
| | | IFNULL(s.share_amount, 0) |
| | | * (IFNULL(s.channel_pay_amount, 0) |
| | | - 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) |
| | | ) 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 |