|
@@ -647,37 +647,84 @@
|
|
|
order by t.orderNum desc
|
|
|
</select>
|
|
|
<select id="userItemDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- select *
|
|
|
- from (select
|
|
|
- t1.user_name as 'userName',
|
|
|
- t2.item_id as 'itemId',
|
|
|
- t2.item_title as 'itemTitle',
|
|
|
- t2.image_url as 'imageUrl',
|
|
|
- t2.reserve_price as 'reservePrice',
|
|
|
- count(t2.oid) as 'orderNum',
|
|
|
- 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',
|
|
|
- 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',
|
|
|
- t2.regimental_promotion_rate as 'regimentalPromotionRate',
|
|
|
- sum(case
|
|
|
- when t2.order_status != 80 then t2.regimental_promotion_amount
|
|
|
- else 0 end) as 'regimentalPromotionAmount'
|
|
|
- from kuaishou_item_bind_user t1
|
|
|
- left join kuaishou_supply_chain t2
|
|
|
- on t1.item_id = t2.item_id
|
|
|
- where 1=1
|
|
|
- <if test="userId != null and userId != ''">
|
|
|
- and t1.user_id = #{userId}
|
|
|
- </if>
|
|
|
|
|
|
+
|
|
|
+ SELECT
|
|
|
+
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.user_id,
|
|
|
+ t1.user_name AS 'userName',
|
|
|
+ t2.item_id AS 'itemId',
|
|
|
+ t2.item_title AS 'itemTitle',
|
|
|
+ t2.image_url AS 'imageUrl',
|
|
|
+ t2.reserve_price AS 'reservePrice',
|
|
|
+ count(t2.oid) AS 'orderNum',
|
|
|
+
|
|
|
+ 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',
|
|
|
+ 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',
|
|
|
+ t2.regimental_promotion_rate AS 'regimentalPromotionRate',
|
|
|
+ sum(
|
|
|
+ CASE
|
|
|
+ WHEN t2.order_status != 80 THEN t2.regimental_promotion_amount
|
|
|
+ ELSE 0
|
|
|
+ END
|
|
|
+ ) AS 'regimentalPromotionAmount'
|
|
|
+ FROM
|
|
|
+ kuaishou_item_bind_user t1
|
|
|
+ LEFT JOIN
|
|
|
+ kuaishou_supply_chain t2 ON t1.item_id = t2.item_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
<if test="start != null and start != ''">
|
|
|
and t2.order_create_time >= #{start}
|
|
|
</if>
|
|
@@ -690,7 +737,13 @@
|
|
|
<if test="itemTitle != null and itemTitle != ''">
|
|
|
and t1.item_title like concat(concat('%',#{itemTitle}),'%')
|
|
|
</if>
|
|
|
- group by t1.item_id) t
|
|
|
+ GROUP BY
|
|
|
+ t1.item_id
|
|
|
+ ) t
|
|
|
+ where 1 = 1
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and t.user_id = #{userId}
|
|
|
+ </if>
|
|
|
order by ${fieId} ${sort}
|
|
|
</select>
|
|
|
<select id="getTimeIntervalRatio" resultType="com.alibaba.fastjson.JSONObject">
|