|
@@ -93,7 +93,7 @@
|
|
|
second_real_commission,
|
|
|
create_time,
|
|
|
stat_date
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
</sql>
|
|
|
|
|
|
<select id="SELECTBytedancePromoterOrderListList"
|
|
@@ -198,8 +198,8 @@
|
|
|
t1.author_bind_user_id,
|
|
|
IFNULL(t1.author_bind_user_name,'-') AS 'userName'
|
|
|
FROM
|
|
|
- bytedance_promoter_order_list t1 LEFT JOIN
|
|
|
- bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ ruixuan.bytedance_promoter_order_list t1 LEFT JOIN
|
|
|
+ ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
<where>
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
@@ -224,8 +224,8 @@
|
|
|
IFNULL(t1.author_short_id,'-') AS 'promoterId',
|
|
|
count( t1.order_id ) AS 'orderNum'
|
|
|
FROM
|
|
|
- bytedance_promoter_order_list t1 LEFT JOIN
|
|
|
- bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ ruixuan.bytedance_promoter_order_list t1 LEFT JOIN
|
|
|
+ ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
<where>
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
@@ -255,7 +255,7 @@
|
|
|
product_name AS 'itemTitle',
|
|
|
product_img AS 'imageUrl',
|
|
|
count(order_id) AS 'orderNum'
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE author_short_id = #{promoterId}
|
|
|
<if test="start != null and start != ''">
|
|
|
and pay_success_time >= #{start}
|
|
@@ -309,11 +309,11 @@
|
|
|
sum(colonel_real_commission)/100 AS 'totalRegimentalSettleAmount',
|
|
|
IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN colonel_real_commission ELSE 0 END)/100, 0) AS
|
|
|
'voucherTotalRegimentalSettleAmount'
|
|
|
- FROM bytedance_promoter_order_list t
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t
|
|
|
LEFT JOIN (
|
|
|
SELECT author_bind_user_id AS 'collectSampleId',
|
|
|
sum(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END) AS 'validOrderNUm'
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE author_bind_user_id is not null
|
|
|
<if test="start != null and start != ''">
|
|
|
and pay_success_time >= #{start}
|
|
@@ -404,7 +404,7 @@
|
|
|
'validRadio',
|
|
|
sum(case when flow_point != 'REFUND' then total_pay_amount else 0 end)/100 AS 'payAmount',
|
|
|
CONCAT(round(colonel_commission_rate/100,2),'%') AS 'regimentalPromotionRate'
|
|
|
- FROM bytedance_promoter_order_list tt
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list tt
|
|
|
WHERE 1= 1
|
|
|
<if test="promoterId != null and promoterId != ''">
|
|
|
and tt.author_short_id = #{promoterId}
|
|
@@ -457,8 +457,8 @@
|
|
|
SUM(CASE
|
|
|
WHEN t1.flow_point != 'REFUND' and t1.colonel_type != 2 THEN t1.second_estimated_commission
|
|
|
ELSE 0 END) / 100 AS 'secondEstimatedCommission'
|
|
|
- FROM bytedance_promoter_order_list t1
|
|
|
- LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t1
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
<where>
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
@@ -485,8 +485,8 @@
|
|
|
SELECT
|
|
|
t1.product_id AS 'itemId',
|
|
|
count(t1.order_id) AS 'orderNum'
|
|
|
- FROM bytedance_promoter_order_list t1
|
|
|
- LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t1
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
<where>
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
@@ -541,8 +541,8 @@
|
|
|
ELSE 0 END) / 100 AS 'secondEstimatedCommission',
|
|
|
sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as
|
|
|
'totalRegimentalSettleAmount'
|
|
|
- FROM bytedance_promoter_order_list t2
|
|
|
- LEFT JOIN bytedance_order_list t3 ON t3.order_id = t2.order_id
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t2
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t3 ON t3.order_id = t2.order_id
|
|
|
WHERE product_bind_user_id is not null
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t3.pay_success_time_hour <= #{hour}
|
|
@@ -565,8 +565,8 @@
|
|
|
SELECT
|
|
|
t2.product_bind_user_id,
|
|
|
count(t2.order_id) AS 'orderNum'
|
|
|
- FROM bytedance_promoter_order_list t2
|
|
|
- LEFT JOIN bytedance_order_list t3 ON t3.order_id = t2.order_id
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t2
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t3 ON t3.order_id = t2.order_id
|
|
|
WHERE product_bind_user_id is not null
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t3.pay_success_time_hour <= #{hour}
|
|
@@ -630,8 +630,8 @@
|
|
|
t1.colonel_real_commission,
|
|
|
t1.colonel_type,
|
|
|
t1.second_estimated_commission
|
|
|
- FROM bytedance_promoter_order_list t1
|
|
|
- LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t1
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
WHERE t2.pay_success_time >= #{start}
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
@@ -667,8 +667,8 @@
|
|
|
SELECT
|
|
|
t1.product_id,
|
|
|
t1.order_id
|
|
|
- FROM bytedance_promoter_order_list t1
|
|
|
- LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t1
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
WHERE t2.pay_success_time >= #{lastTimeStart}
|
|
|
AND t2.pay_success_time <= #{lastTimeEnd}
|
|
|
<if test="hour != null and hour != ''">
|
|
@@ -691,7 +691,7 @@
|
|
|
SELECT author_short_id AS 'promoterId',
|
|
|
author_short_name AS 'promoterNickName',
|
|
|
count(order_id) AS 'orderNum'
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE product_id = #{itemId}
|
|
|
AND author_bind_user_id is not null
|
|
|
<if test="start != null and start != ''">
|
|
@@ -714,7 +714,7 @@
|
|
|
SELECT
|
|
|
order_id,
|
|
|
pay_success_time
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE 1 = 1
|
|
|
<if test="promoterId != null and promoterId != ''">
|
|
|
and author_short_id = #{promoterId}
|
|
@@ -743,7 +743,7 @@
|
|
|
sum(case when flow_point = 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
|
|
|
CONCAT(round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id)*100, 2),'%') as
|
|
|
'validRadio'
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE 1= 1
|
|
|
<if test="itemId != null and itemId != ''">
|
|
|
and product_id = #{itemId}
|
|
@@ -775,7 +775,7 @@
|
|
|
round(sum(t2.pay_goods_amount) / 100, 2) as 'regimentalPromotionAmount',
|
|
|
round(sum(t2.settled_goods_amount) / 100, 2) as 'totalRegimentalSettleAmount'
|
|
|
from promoter_bind_channel_date t1
|
|
|
- left join bytedance_promoter_order_list t2
|
|
|
+ left join ruixuan.bytedance_promoter_order_list t2
|
|
|
on t1.promoter_id = t2.author_short_id and t1.stat_date = t2.pay_success_time
|
|
|
where 1 = 1
|
|
|
<if test="start != null and start != '' ">
|
|
@@ -810,7 +810,7 @@
|
|
|
round(sum(t2.pay_goods_amount) / 100, 2) as 'regimentalPromotionAmount',
|
|
|
round(sum(t2.settled_goods_amount) / 100, 2) as 'totalRegimentalSettleAmount'
|
|
|
from promoter_bind_channel_date t1
|
|
|
- left join bytedance_promoter_order_list t2
|
|
|
+ left join ruixuan.bytedance_promoter_order_list t2
|
|
|
on t1.promoter_id = t2.author_short_id and t1.stat_date = t2.pay_success_time
|
|
|
where 1 = 1
|
|
|
<if test="start != null and start != '' ">
|
|
@@ -845,7 +845,7 @@
|
|
|
'regimentalPromotionAmount',
|
|
|
sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_real_commission ELSE 0 END ) AS
|
|
|
'totalRegimentalSettleAmount'
|
|
|
- FROM bytedance_promoter_order_list t2
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list t2
|
|
|
WHERE
|
|
|
1 = 1
|
|
|
<if test="start != null and start != ''">
|
|
@@ -880,7 +880,7 @@
|
|
|
round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_real_commission ELSE 0 END ) / 100, 2 ) AS
|
|
|
'totalRegimentalSettleAmount',
|
|
|
CONCAT(round(colonel_commission_rate/100,2),'%') AS 'itemCommissionRate'
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE
|
|
|
product_bind_user_id is not null
|
|
|
<if test="start != null and start != ''">
|
|
@@ -915,7 +915,7 @@
|
|
|
sum(case when flow_point != 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
|
|
|
CONCAT(round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id)*100, 2),'%') AS
|
|
|
'validRadio'
|
|
|
- FROM bytedance_promoter_order_list
|
|
|
+ FROM ruixuan.bytedance_promoter_order_list
|
|
|
WHERE author_short_id is not null
|
|
|
<if test="start != null and start != ''">
|
|
|
and pay_success_time >= #{start}
|
|
@@ -973,7 +973,7 @@
|
|
|
100 AS 'secondEstimatedCommission',
|
|
|
round(sum(t2.colonel_real_commission) / 100, 2) as 'totalRegimentalSettleAmount'
|
|
|
from (select user_id, user_name, promoter_id, stat_date
|
|
|
- from promoter_bind_channel_date
|
|
|
+ from ruixuan.promoter_bind_channel_date
|
|
|
where media_id = 1
|
|
|
<if test="start != null and start != ''">
|
|
|
and stat_date >= #{start}
|
|
@@ -987,7 +987,7 @@
|
|
|
) t1
|
|
|
left join (
|
|
|
select *
|
|
|
- from bytedance_order_list
|
|
|
+ from ruixuan.bytedance_order_list
|
|
|
<where>
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and pay_success_time_hour <= #{hour}
|
|
@@ -1007,7 +1007,7 @@
|
|
|
select t1.user_id,
|
|
|
count(t2.order_id) as 'orderNum'
|
|
|
from (select user_id, promoter_id, stat_date
|
|
|
- from promoter_bind_channel_date
|
|
|
+ from ruixuan.promoter_bind_channel_date
|
|
|
where media_id = 1
|
|
|
<if test="lastTimeStart != null and lastTimeStart != ''">
|
|
|
and stat_date >= #{lastTimeStart}
|
|
@@ -1023,7 +1023,7 @@
|
|
|
select author_short_id,
|
|
|
order_id,
|
|
|
pay_success_time
|
|
|
- from bytedance_order_list
|
|
|
+ from ruixuan.bytedance_order_list
|
|
|
<where>
|
|
|
<if test="hour != null and hour != ''">
|
|
|
and pay_success_time_hour <= #{hour}
|
|
@@ -1040,18 +1040,18 @@
|
|
|
) t11 ON t11.user_id = t.collectSampleId
|
|
|
left join (select user_id,
|
|
|
count(distinct promoter_id) as 'promoterCount'
|
|
|
- from kuaishou_promoter
|
|
|
+ from ruixuan.kuaishou_promoter
|
|
|
group by user_id) tt on t.collectSampleId = tt.user_id
|
|
|
left join (select collect_sample_id as 'user_id',
|
|
|
count(distinct promoter_id) as 'sampleCount'
|
|
|
- from kuaishou_item_collect_samples
|
|
|
+ from ruixuan.kuaishou_item_collect_samples
|
|
|
where collect_sample_status > 2
|
|
|
group by collect_sample_id) ttt on t.collectSampleId = ttt.user_id
|
|
|
left join (select collect_sample_id as 'user_id',
|
|
|
count(1) as 'sendTotalCount',
|
|
|
count(distinct promoter_id) as 'sendPromoterCount',
|
|
|
count(distinct item_id) as 'sendItemCount'
|
|
|
- from kuaishou_item_collect_samples
|
|
|
+ from ruixuan.kuaishou_item_collect_samples
|
|
|
where collect_sample_status > 2
|
|
|
<if test="collectSampleId != null and collectSampleId != ''">
|
|
|
and collect_sample_id = #{collectSampleId}
|
|
@@ -1065,7 +1065,7 @@
|
|
|
</if>
|
|
|
group by collect_sample_id) tttt on t.collectSampleId = tttt.user_id
|
|
|
left join (select user_id, promoters_count
|
|
|
- from user_promoters_count
|
|
|
+ from ruixuan.user_promoters_count
|
|
|
where media_id = 1) ttttt
|
|
|
on t.collectSampleId = ttttt.user_id
|
|
|
where t.orderNum > 0
|
|
@@ -1103,8 +1103,8 @@
|
|
|
left join
|
|
|
(
|
|
|
select t1.*
|
|
|
- from bytedance_promoter_order_list t1
|
|
|
- LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ from ruixuan.bytedance_promoter_order_list t1
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
where t2.pay_success_time >= #{bindStartDate}
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
|
) t2 ON t1.promoter_id = t2.author_short_id
|
|
@@ -1128,8 +1128,8 @@
|
|
|
from kuaishou_promoter t1
|
|
|
left join
|
|
|
(select t1.order_id,t1.author_short_id
|
|
|
- from bytedance_promoter_order_list t1
|
|
|
- LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
+ from ruixuan.bytedance_promoter_order_list t1
|
|
|
+ LEFT JOIN ruixuan.bytedance_order_list t2 ON t1.order_id = t2.order_id
|
|
|
where t2.pay_success_time >= #{lastTimeStart}
|
|
|
AND t2.pay_success_time <= #{lastTimeEnd}
|
|
|
and t2.pay_success_time_hour <= #{hour}
|
|
@@ -1209,7 +1209,7 @@
|
|
|
then second_estimated_commission
|
|
|
ELSE 0 END) * 0.9 / 100 AS
|
|
|
'regimentalPromotionAmount'
|
|
|
- from bytedance_order_list
|
|
|
+ from ruixuan.bytedance_order_list
|
|
|
where author_short_id = #{promoterId}
|
|
|
and pay_success_time >= #{start}
|
|
|
and pay_success_time <= #{end}
|