longz
2026-07-21 d4c624cab763b39c45cd67de309bf7526a7037a4
fix: 全额退款后移除分成统计
1个文件已修改
32 ■■■■■ 已修改文件
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -2334,18 +2334,21 @@
    <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)
            &lt; 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">
@@ -2359,6 +2362,8 @@
        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)
            &lt; IFNULL(s.channel_pay_amount, 0)
        <if test="sixBefore != null">
            and o.create_time &gt;= #{sixBefore}
        </if>
@@ -2373,12 +2378,15 @@
    <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)
            &lt; 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>