|
@@ -121,22 +121,24 @@
|
|
|
</select>
|
|
|
<select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select *
|
|
|
- from (
|
|
|
- select
|
|
|
- item_id as 'itemId',
|
|
|
- reserve_price as 'reservePrice',
|
|
|
- item_title as 'itemTitle',
|
|
|
- image_url as 'imageUrl',
|
|
|
- count(oid) as 'orderNum',
|
|
|
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
- then 1 else 0 end),4) as 'deliveryRadio',
|
|
|
- item_commission_rate as 'itemCommissionRate'
|
|
|
- from kuaishou_supply_chain
|
|
|
- where 1= 1
|
|
|
+ from (select t2.user_id as 'userId',
|
|
|
+ t2.user_name as 'userName',
|
|
|
+ t1.item_id as 'itemId',
|
|
|
+ t1.reserve_price as 'reservePrice',
|
|
|
+ t1.item_title as 'itemTitle',
|
|
|
+ t1.image_url as 'imageUrl',
|
|
|
+ count(t1.oid) as 'orderNum',
|
|
|
+ sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
+ round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid), 4) as 'validRadio',
|
|
|
+ sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when
|
|
|
+ t1.order_status != 80 then 1 else 0 end), 4) as 'deliveryRadio',
|
|
|
+ t1.item_commission_rate as 'itemCommissionRate'
|
|
|
+ from kuaishou_supply_chain t1
|
|
|
+ left join kuaishou_item_bind_user t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ where 1 = 1
|
|
|
<if test="start != null and start != ''">
|
|
|
and order_create_time >= #{start}
|
|
|
</if>
|
|
@@ -149,7 +151,11 @@
|
|
|
<if test="itemTitle != null and itemTitle != ''">
|
|
|
and item_title like concat(concat('%',#{itemTitle}),'%')
|
|
|
</if>
|
|
|
- group by item_id) t
|
|
|
+ group by t1.item_id) t
|
|
|
+ where 1 = 1
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and t.userId = #{userId}
|
|
|
+ </if>
|
|
|
order by ${fieId} ${sort}
|
|
|
</select>
|
|
|
|
|
@@ -225,7 +231,8 @@
|
|
|
regimental_promotion_rate as 'regimentalPromotionRate',
|
|
|
sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
|
|
|
sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
|
|
|
- sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount',
|
|
|
+ sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount',
|
|
|
item_commission_rate as 'itemCommissionRate'
|
|
|
from kuaishou_supply_chain
|
|
|
where 1= 1
|
|
@@ -289,7 +296,8 @@
|
|
|
sum(order_amount) as 'orderAmount',
|
|
|
sum(base_amount) as 'baseAmount',
|
|
|
sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
|
|
|
- sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount'
|
|
|
+ sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount'
|
|
|
from kuaishou_supply_chain
|
|
|
where 1= 1
|
|
|
<if test="start != null and start != ''">
|
|
@@ -540,42 +548,50 @@
|
|
|
</select>
|
|
|
<select id="exportOrder" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select *
|
|
|
- from (
|
|
|
- select
|
|
|
- item_id as 'itemId',
|
|
|
- item_title as 'itemTitle',
|
|
|
- image_url as 'imageUrl',
|
|
|
- promoter_id as 'promoterId',
|
|
|
- promoter_nick_name as 'promoterNickName',
|
|
|
- count(oid) as 'orderNum',
|
|
|
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,2) as 'validRadio',
|
|
|
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
|
|
|
- then 1 else 0 end) * 100,2) as 'deliveryRadio'
|
|
|
- from kuaishou_supply_chain
|
|
|
- where 1= 1
|
|
|
+ from (select
|
|
|
+ t2.user_id as 'userId',
|
|
|
+ t2.user_name as 'userName',
|
|
|
+ t1.item_id as 'itemId',
|
|
|
+ t1.item_title as 'itemTitle',
|
|
|
+ t1.image_url as 'imageUrl',
|
|
|
+ t1.promoter_id as 'promoterId',
|
|
|
+ t1.promoter_nick_name as 'promoterNickName',
|
|
|
+ count(t1.oid) as 'orderNum',
|
|
|
+ sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
|
+ round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid) * 100, 2) as 'validRadio',
|
|
|
+ sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(case when t1.send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when t1.order_status
|
|
|
+ != 80 then 1 else 0 end) * 100, 2) as 'deliveryRadio',
|
|
|
+ round(t1.item_commission_rate / 10,2) as 'itemCommissionRate'
|
|
|
+ from kuaishou_supply_chain t1
|
|
|
+ left join kuaishou_item_bind_user t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ where 1 = 1
|
|
|
<if test="start != null and start != ''">
|
|
|
- and order_create_time >= #{start}
|
|
|
+ and t1.order_create_time >= #{start}
|
|
|
</if>
|
|
|
<if test="end != null and end != ''">
|
|
|
- and order_create_time <= #{end}
|
|
|
+ and t1.order_create_time <= #{end}
|
|
|
</if>
|
|
|
<if test="promoterId != null and promoterId != ''">
|
|
|
- and promoter_id = #{promoterId}
|
|
|
+ and t1.promoter_id = #{promoterId}
|
|
|
</if>
|
|
|
<if test="promoterNickName != null and promoterNickName != ''">
|
|
|
- and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
|
|
|
+ and t1.promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
|
|
|
</if>
|
|
|
<if test="itemId != null and itemId != ''">
|
|
|
- and item_id = #{itemId}
|
|
|
+ and t1.item_id = #{itemId}
|
|
|
</if>
|
|
|
<if test="itemTitle != null and itemTitle != ''">
|
|
|
- and item_title like concat(concat('%',#{itemTitle}),'%')
|
|
|
+ and t1.item_title like concat(concat('%',#{itemTitle}),'%')
|
|
|
+ </if>
|
|
|
+ group by t1.item_id, t1.promoter_id) t
|
|
|
+ where 1 = 1
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and t.userId = #{userId}
|
|
|
</if>
|
|
|
- group by item_id,promoter_id) t
|
|
|
- order by t.itemId,t.orderNum desc
|
|
|
+ order by t.itemId, t.orderNum desc
|
|
|
</select>
|
|
|
<select id="bindUserItemList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select *
|
|
@@ -649,7 +665,8 @@
|
|
|
sum(case
|
|
|
when t2.order_status != 80 then t2.regimental_promotion_amount
|
|
|
else 0 end) as 'regimentalPromotionAmount',
|
|
|
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount'
|
|
|
+ sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount'
|
|
|
from kuaishou_item_bind_user t1
|
|
|
left join kuaishou_supply_chain t2
|
|
|
on t1.item_id = t2.item_id
|
|
@@ -737,7 +754,8 @@
|
|
|
ELSE 0
|
|
|
END
|
|
|
) AS 'regimentalPromotionAmount',
|
|
|
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount',
|
|
|
+ sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
|
|
|
+ 'totalRegimentalSettleAmount',
|
|
|
t2.item_commission_rate as 'itemCommissionRate'
|
|
|
FROM
|
|
|
kuaishou_item_bind_user t1
|