|
@@ -36,7 +36,8 @@
|
|
|
|
|
|
|
|
|
|
<select id="getOrderList" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getOrderList" resultType="com.alibaba.fastjson.JSONObject">
|
|
- select *
|
|
|
|
|
|
+ select t.*,t2.userName,
|
|
|
|
+ ROUND(((t.orderNum-t3.orderNum)/t3.orderNum)*100,2) as 'orderNumRoi'
|
|
from (
|
|
from (
|
|
select promoter_id as 'promoterId',
|
|
select promoter_id as 'promoterId',
|
|
promoter_nick_name as 'promoterNickName',
|
|
promoter_nick_name as 'promoterNickName',
|
|
@@ -54,7 +55,7 @@
|
|
then 1 else 0 end),4) as 'deliveryRadio',
|
|
then 1 else 0 end),4) as 'deliveryRadio',
|
|
sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount'
|
|
sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount'
|
|
from kuaishou_supply_chain
|
|
from kuaishou_supply_chain
|
|
- where 1= 1
|
|
|
|
|
|
+ where stat_hour <= #{hour}
|
|
<if test="start != null and start != ''">
|
|
<if test="start != null and start != ''">
|
|
and stat_date >= #{start}
|
|
and stat_date >= #{start}
|
|
</if>
|
|
</if>
|
|
@@ -67,11 +68,31 @@
|
|
<if test="promoterNickName != null and promoterNickName != ''">
|
|
<if test="promoterNickName != null and promoterNickName != ''">
|
|
and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
|
|
and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
|
|
</if>
|
|
</if>
|
|
- group by promoter_id) t left join (
|
|
|
|
|
|
+ group by promoter_id
|
|
|
|
+ ) t left join (
|
|
select promoter_id as 'promoterId',group_concat(user_name) as 'userName' from kuaishou_promoter where media_id =
|
|
select promoter_id as 'promoterId',group_concat(user_name) as 'userName' from kuaishou_promoter where media_id =
|
|
2
|
|
2
|
|
group by promoter_id
|
|
group by promoter_id
|
|
) t2 on t.promoterId = t2.promoterId
|
|
) t2 on t.promoterId = t2.promoterId
|
|
|
|
+ left join (
|
|
|
|
+ select promoter_id as 'promoterId',
|
|
|
|
+ count(oid) as 'orderNum'
|
|
|
|
+ from kuaishou_supply_chain
|
|
|
|
+ where stat_hour <= #{hour}
|
|
|
|
+ <if test="lastTimeStart != null and lastTimeStart != ''">
|
|
|
|
+ and stat_date >= #{lastTimeStart}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="lastTimeEnd != null and lastTimeEnd != ''">
|
|
|
|
+ and stat_date <= #{lastTimeEnd}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="promoterId != null and promoterId != ''">
|
|
|
|
+ and promoter_id = #{promoterId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="promoterNickName != null and promoterNickName != ''">
|
|
|
|
+ and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
|
|
|
|
+ </if>
|
|
|
|
+ group by promoter_id
|
|
|
|
+ ) t3 on t.promoterId = t3.promoterId
|
|
order by t.orderNum desc
|
|
order by t.orderNum desc
|
|
</select>
|
|
</select>
|
|
<select id="getTopOrders" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getTopOrders" resultType="com.alibaba.fastjson.JSONObject">
|
|
@@ -170,13 +191,16 @@
|
|
</select>
|
|
</select>
|
|
<select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
|
|
select *
|
|
select *
|
|
- from (select t2.user_id as 'userId',
|
|
|
|
|
|
+ from (
|
|
|
|
+ select
|
|
|
|
+ t2.user_id as 'userId',
|
|
t2.user_name as 'userName',
|
|
t2.user_name as 'userName',
|
|
t1.item_id as 'itemId',
|
|
t1.item_id as 'itemId',
|
|
t1.reserve_price as 'reservePrice',
|
|
t1.reserve_price as 'reservePrice',
|
|
t1.item_title as 'itemTitle',
|
|
t1.item_title as 'itemTitle',
|
|
t1.image_url as 'imageUrl',
|
|
t1.image_url as 'imageUrl',
|
|
count(t1.oid) as 'orderNum',
|
|
count(t1.oid) as 'orderNum',
|
|
|
|
+ ROUND(((count(t1.oid)-t6.orderNum)/t6.orderNum)*100,2) as 'orderNumRoi',
|
|
sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
|
|
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',
|
|
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 then 1 else 0 end) as 'deliveryNum',
|
|
sum(case when t1.send_status = 1 then 1 else 0 end) as 'deliveryNum',
|
|
@@ -217,7 +241,26 @@
|
|
on t1.item_id = t4.item_id
|
|
on t1.item_id = t4.item_id
|
|
left join kuaishou_item_list t5
|
|
left join kuaishou_item_list t5
|
|
on t1.item_id = t5.item_id
|
|
on t1.item_id = t5.item_id
|
|
- where 1 = 1
|
|
|
|
|
|
+ left join (
|
|
|
|
+ select
|
|
|
|
+ item_id as 'itemId',
|
|
|
|
+ count(oid) as 'orderNum'
|
|
|
|
+ from kuaishou_supply_chain
|
|
|
|
+ where stat_hour <= #{hour}
|
|
|
|
+ <if test="lastTimeStart != null and lastTimeStart != ''">
|
|
|
|
+ and stat_date >= #{lastTimeStart}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="lastTimeEnd != null and lastTimeEnd != ''">
|
|
|
|
+ and stat_date <= #{lastTimeEnd}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="itemId != null and itemId != ''">
|
|
|
|
+ and item_id = #{itemId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="itemTitle != null and itemTitle != ''">
|
|
|
|
+ and item_title like concat(concat('%',#{itemTitle}),'%')
|
|
|
|
+ </if>
|
|
|
|
+ group by item_id) t6 on t1.item_id = t6.itemId
|
|
|
|
+ where t1.stat_hour <= #{hour}
|
|
<if test="start != null and start != ''">
|
|
<if test="start != null and start != ''">
|
|
and t1.stat_date >= #{start}
|
|
and t1.stat_date >= #{start}
|
|
</if>
|
|
</if>
|
|
@@ -299,7 +342,6 @@
|
|
on t1.itemId = t3.item_id
|
|
on t1.itemId = t3.item_id
|
|
left join kuaishou_item_list t4
|
|
left join kuaishou_item_list t4
|
|
on t1.itemId = t4.item_id
|
|
on t1.itemId = t4.item_id
|
|
-
|
|
|
|
where 1 = 1
|
|
where 1 = 1
|
|
<if test="itemId != null and itemId != ''">
|
|
<if test="itemId != null and itemId != ''">
|
|
and t1.itemId = #{itemId}
|
|
and t1.itemId = #{itemId}
|
|
@@ -1005,7 +1047,9 @@
|
|
ORDER BY t.create_time DESC
|
|
ORDER BY t.create_time DESC
|
|
</select>
|
|
</select>
|
|
<select id="adminReportList" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="adminReportList" resultType="com.alibaba.fastjson.JSONObject">
|
|
- select *
|
|
|
|
|
|
+ select t.*,
|
|
|
|
+ t1.sendSampleCount,
|
|
|
|
+ ROUND(((t.orderNum-t3.orderNum)/t3.orderNum)*100,2) as 'orderNumRoi'
|
|
from (select t1.user_id as 'userId',
|
|
from (select t1.user_id as 'userId',
|
|
t1.user_name as 'userName',
|
|
t1.user_name as 'userName',
|
|
count(distinct t2.item_id) as 'itemCount',
|
|
count(distinct t2.item_id) as 'itemCount',
|
|
@@ -1037,19 +1081,35 @@
|
|
from kuaishou_item_bind_user t1
|
|
from kuaishou_item_bind_user t1
|
|
left join kuaishou_supply_chain t2
|
|
left join kuaishou_supply_chain t2
|
|
on t1.item_id = t2.item_id
|
|
on t1.item_id = t2.item_id
|
|
- where 1= 1
|
|
|
|
|
|
+ where t2.stat_hour <= #{hour}
|
|
<if test="start != null and start != ''">
|
|
<if test="start != null and start != ''">
|
|
- and t2.stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
|
|
|
|
+ and t2.stat_date >=#{start}
|
|
</if>
|
|
</if>
|
|
<if test="end != null and end != ''">
|
|
<if test="end != null and end != ''">
|
|
- and t2.stat_date <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
|
|
|
|
+ and t2.stat_date <= #{end}
|
|
</if>
|
|
</if>
|
|
- group by t1.user_id) t left join (
|
|
|
|
|
|
+ group by t1.user_id
|
|
|
|
+ ) t left join (
|
|
select item_create_id,count(1) as 'sendSampleCount' from kuaishou_item_collect_samples
|
|
select item_create_id,count(1) as 'sendSampleCount' from kuaishou_item_collect_samples
|
|
where courier_number_time >= #{startDate}
|
|
where courier_number_time >= #{startDate}
|
|
and courier_number_time <= #{endDate}
|
|
and courier_number_time <= #{endDate}
|
|
group by item_create_id
|
|
group by item_create_id
|
|
) t1 on t.userId = t1.item_create_id
|
|
) t1 on t.userId = t1.item_create_id
|
|
|
|
+ left join (
|
|
|
|
+ select t1.user_id as 'userId',
|
|
|
|
+ count(t2.oid) as 'orderNum'
|
|
|
|
+ from kuaishou_item_bind_user t1
|
|
|
|
+ left join kuaishou_supply_chain t2
|
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
|
+ where t2.stat_hour <= #{hour}
|
|
|
|
+ <if test="lastTimeStart != null and lastTimeStart != ''">
|
|
|
|
+ and t2.stat_date >= #{lastTimeStart}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="lastTimeEnd != null and lastTimeEnd != ''">
|
|
|
|
+ and t2.stat_date <= #{lastTimeEnd}
|
|
|
|
+ </if>
|
|
|
|
+ group by t1.user_id
|
|
|
|
+ ) t3 on t.userId = t3.userId
|
|
where 1 =1
|
|
where 1 =1
|
|
<if test="userId != null and userId != ''">
|
|
<if test="userId != null and userId != ''">
|
|
and t.userId = #{userId}
|
|
and t.userId = #{userId}
|