|
@@ -220,16 +220,31 @@
|
|
<select id="getManageChargeCommission" resultType="java.math.BigDecimal">
|
|
<select id="getManageChargeCommission" resultType="java.math.BigDecimal">
|
|
SELECT IFNULL(ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge, 3), 0.0)
|
|
SELECT IFNULL(ROUND(t1.totalCharge - t2.JLCharge - t2.KFCharge, 3), 0.0)
|
|
FROM (
|
|
FROM (
|
|
- SELECT SUM(charge) as 'totalCharge'
|
|
|
|
|
|
+ SELECT SUM(charge) AS 'totalCharge'
|
|
FROM application.kuaishou_operation_performance_base
|
|
FROM application.kuaishou_operation_performance_base
|
|
WHERE leader_id = #{userId}
|
|
WHERE leader_id = #{userId}
|
|
|
|
+ AND user_id NOT IN (
|
|
|
|
+ SELECT assistant_id
|
|
|
|
+ FROM sys_operate_rel
|
|
|
|
+ WHERE operate_id = #{userId}
|
|
|
|
+ AND stat_month >= DATE_FORMAT(#{startDate}, '%Y-%m')
|
|
|
|
+ AND stat_month <= DATE_FORMAT(#{endDate}, '%Y-%m')
|
|
|
|
+ )
|
|
AND stat_date >= #{startDate}
|
|
AND stat_date >= #{startDate}
|
|
AND stat_date <= #{endDate}
|
|
AND stat_date <= #{endDate}
|
|
) t1
|
|
) t1
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
- SELECT SUM(contract_rebate_real_charged_in_yuan) as 'KFCharge', SUM(direct_rebate_real_charged_in_yuan) as 'JLCharge'
|
|
|
|
|
|
+ SELECT SUM(contract_rebate_real_charged_in_yuan) as 'KFCharge', SUM(direct_rebate_real_charged_in_yuan) as
|
|
|
|
+ 'JLCharge'
|
|
FROM application.kuaishou_operation_performance_back_charge_base
|
|
FROM application.kuaishou_operation_performance_back_charge_base
|
|
WHERE leader_id = #{userId}
|
|
WHERE leader_id = #{userId}
|
|
|
|
+ AND user_id NOT IN (
|
|
|
|
+ SELECT assistant_id
|
|
|
|
+ FROM sys_operate_rel
|
|
|
|
+ WHERE operate_id = #{userId}
|
|
|
|
+ AND stat_month >= DATE_FORMAT(#{startDate}, '%Y-%m')
|
|
|
|
+ AND stat_month <= DATE_FORMAT(#{endDate}, '%Y-%m')
|
|
|
|
+ )
|
|
AND stat_date >= #{startDate}
|
|
AND stat_date >= #{startDate}
|
|
AND stat_date <= #{endDate}
|
|
AND stat_date <= #{endDate}
|
|
) t2 ON 1 = 1
|
|
) t2 ON 1 = 1
|