|
@@ -1619,7 +1619,7 @@
|
|
|
round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
|
|
|
when t2.order_status != 80
|
|
|
then 1
|
|
|
- else 0 end) * 100,
|
|
|
+ else 0 end) * 100,
|
|
|
2) as 'deliveryRadio',
|
|
|
sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
|
|
|
round(sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) / 100 , 2) as 'payAmount',
|
|
@@ -1664,26 +1664,26 @@
|
|
|
order by t3.create_time asc
|
|
|
</select>
|
|
|
<select id="adminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- select * from (
|
|
|
- select t1.user_id as 'userId',
|
|
|
- t1.user_name as 'userName',
|
|
|
- count(distinct t1.item_id) as 'itemCount',
|
|
|
- count(t2.oid) as 'orderNum',
|
|
|
+ select * from (
|
|
|
+ select t1.user_id as 'userId',
|
|
|
+ t1.user_name as 'userName',
|
|
|
+ count(distinct t1.item_id) as 'itemCount',
|
|
|
+ count(t2.oid) as 'orderNum',
|
|
|
count(distinct t3.courier_number) as 'sendSampleCount',
|
|
|
- sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
- round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid), 4) as 'validRadio',
|
|
|
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
+ round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid), 4) as 'validRadio',
|
|
|
+ sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
|
|
|
when t2.order_status != 80
|
|
|
then 1
|
|
|
else 0 end),
|
|
|
- 4) as 'deliveryRadio',
|
|
|
- sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
|
|
|
- sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) as 'payAmount',
|
|
|
+ 4) as 'deliveryRadio',
|
|
|
+ sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
|
|
|
+ sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) as 'payAmount',
|
|
|
sum(case
|
|
|
when t2.order_status != 80 then t2.regimental_promotion_amount
|
|
|
- else 0 end) as 'regimentalPromotionAmount',
|
|
|
+ else 0 end) as 'regimentalPromotionAmount',
|
|
|
sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
|
|
|
'totalRegimentalSettleAmount'
|
|
|
from kuaishou_item_list t1
|
|
@@ -1697,25 +1697,30 @@
|
|
|
from kuaishou_supply_chain
|
|
|
where order_create_time >= #{start}) t2
|
|
|
on t1.item_id = t2.item_id
|
|
|
- left join (select item_id, courier_number
|
|
|
- from kuaishou_item_collect_samples
|
|
|
- where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')) t3 on t1.item_id = t3.item_id
|
|
|
where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
<if test="userId != null and userId != ''">
|
|
|
and t1.userId = #{userId}
|
|
|
</if>
|
|
|
- group by t1.user_id ) t order by t.orderNum desc
|
|
|
+ group by t1.user_id ) left join (
|
|
|
+ select t1.user_id,count(distinct courier_number) as 'sendSampleCount' from kuaishou_item_list t1 left join
|
|
|
+ kuaishou_item_collect_samples t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ and t2.courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ group by t1.user_id
|
|
|
+ ) t2 on t.userId = t2.user_id order by t.orderNum desc
|
|
|
</select>
|
|
|
<select id="exportAdminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- select * from (
|
|
|
- select t1.user_id as 'userId',
|
|
|
- t1.user_name as 'userName',
|
|
|
- count(distinct t1.item_id) as 'itemCount',
|
|
|
- count(t2.oid) as 'orderNum',
|
|
|
+ select * from (
|
|
|
+ select t1.user_id as 'userId',
|
|
|
+ t1.user_name as 'userName',
|
|
|
+ count(distinct t1.item_id) as 'itemCount',
|
|
|
+ count(t2.oid) as 'orderNum',
|
|
|
count(distinct t3.courier_number) as 'sendSampleCount',
|
|
|
sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
- round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100,2) as 'validRadio',
|
|
|
+ round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100,2) as 'validRadio',
|
|
|
sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
|
|
@@ -1741,15 +1746,20 @@
|
|
|
from kuaishou_supply_chain
|
|
|
where order_create_time >= #{start}) t2
|
|
|
on t1.item_id = t2.item_id
|
|
|
- left join (select item_id, courier_number
|
|
|
- from kuaishou_item_collect_samples
|
|
|
- where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')) t3 on t1.item_id = t3.item_id
|
|
|
where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
<if test="userId != null and userId != ''">
|
|
|
and t1.userId = #{userId}
|
|
|
</if>
|
|
|
- group by t1.user_id ) t order by t.orderNum desc
|
|
|
+ group by t1.user_id ) t left join (
|
|
|
+ select t1.user_id,count(distinct courier_number) as 'sendSampleCount' from kuaishou_item_list t1 left join
|
|
|
+ kuaishou_item_collect_samples t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ and t2.courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
|
|
|
+ group by t1.user_id
|
|
|
+ ) t2 on t.userId = t2.user_id order by t.orderNum desc;
|
|
|
|
|
|
</select>
|
|
|
</mapper>
|