| | |
| | | <select id="chargingOrderShareIncomeByOrderIds" resultType="map"> |
| | | select |
| | | o.id as orderId, |
| | | sum(IFNULL(s.channel_pay_amount, 0) - IFNULL(s.share_amount, 0)) as platformIncome, |
| | | sum(IFNULL(s.channel_electricity_amount, 0) + IFNULL(s.channel_service_amount, 0) - IFNULL(s.share_amount, 0)) as platformIncome, |
| | | sum(IFNULL(s.share_amount, 0)) as partnerIncome, |
| | | CASE WHEN o.is_whitelist = 1 AND o.status = 5 THEN IFNULL(o.whitelist_electric_refund_amount, 0) |
| | | CASE WHEN o.is_whitelist = 1 AND o.status = 5 AND NOT EXISTS ( |
| | | SELECT 1 FROM `charging_pile_order`.t_charging_order_share_record s2 |
| | | WHERE s2.charging_order_id = o.id AND s2.del_flag = 0) |
| | | THEN IFNULL(o.whitelist_electric_refund_amount, 0) |
| | | + IFNULL(o.whitelist_service_refund_amount, 0) ELSE 0 END as whitelistRefund |
| | | from `charging_pile_order`.t_charging_order o |
| | | left join `charging_pile_order`.t_charging_order_share_record s |
| | |
| | | |
| | | <select id="chargingOrderShareIncomeSummaryByOrderIds" resultType="map"> |
| | | select |
| | | sum(IFNULL(s.channel_pay_amount, 0) - IFNULL(s.share_amount, 0)) as platformIncomeTotal, |
| | | sum(IFNULL(s.channel_electricity_amount, 0) + IFNULL(s.channel_service_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 |
| | |
| | | + IFNULL(whitelist_service_refund_amount, 0)), 0) |
| | | from `charging_pile_order`.t_charging_order |
| | | where del_flag = 0 and is_whitelist = 1 and status = 5 |
| | | and not exists ( |
| | | select 1 from `charging_pile_order`.t_charging_order_share_record s |
| | | where s.charging_order_id = t_charging_order.id and s.del_flag = 0) |
| | | <if test="orderIds != null and orderIds.size()>0"> |
| | | and id in |
| | | <foreach collection="orderIds" item="item" index="index" separator="," open="(" close=")"> |