浏览代码

店铺管理

yumeng 11 月之前
父节点
当前提交
a114786e8c
共有 1 个文件被更改,包括 25 次插入22 次删除
  1. 25 22
      ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

+ 25 - 22
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -3927,51 +3927,54 @@
         ORDER BY tag_oid_num DESC limit 5
     </select>
     <select id="shopList" resultType="com.alibaba.fastjson.JSONObject">
-        select t1.seller_id as 'sellerId',
-        MAX(t2.shop_title) as 'sellerName',
-        sum(case when t1.order_status = 60 then 1 else 0 end) as 'settledOrderNUm',
-        round(sum(case when t1.order_status = 60 then 1 else 0 end) / count(t1.oid) * 100,
+        SELECT t2.shopTitle as 'sellerName',t1.* from (
+        select seller_id as 'sellerId',
+        sum(case when order_status = 60 then 1 else 0 end) as 'settledOrderNUm',
+        round(sum(case when order_status = 60 then 1 else 0 end) / count(oid) * 100,
         2) as 'settledOrderRate',
-        count(t1.oid) as 'orderNum',
-        round(sum(case when t1.order_status != 80 then t1.pay_amount else 0 end) / 100,
+        count(oid) as 'orderNum',
+        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100,
         2) as 'payAmount',
-        round(t1.regimental_promotion_rate / 10, 2) as 'regimentalPromotionRate',
-        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,
+        round(regimental_promotion_rate / 10, 2) as 'regimentalPromotionRate',
+        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 t1.send_status = 1 then 1 else 0 end) as 'deliveryNum',
-        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
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
+        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 'shippingGreen',
-        sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
-        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.send_status = 1
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
+        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 send_status = 1
         then 1
         else 0 end) * 100,
         2) as 'deliveryRadio'
-        from kuaishou_supply_chain t1 LEFT JOIN kuaishou_activity_open_item_list t2 on t1.item_id = t2.item_id
+        from kuaishou_supply_chain t1 LEFT JOIN  kuaishou_activity_open_item_list t2 on t1.item_id = t2.item_id
         where 1 = 1
         <if test="start != null and start != ''">
-            and t1.stat_date &gt;= #{start}
+            and stat_date &gt;= #{start}
         </if>
         <if test="end != null and end != ''">
-            and t1.stat_date &lt;= #{end}
+            and stat_date &lt;= #{end}
         </if>
         <if test="sellerId != null and sellerId != ''">
-            and t1.seller_id = #{sellerId}
+            and seller_id = #{sellerId}
         </if>
         <if test='itemIds != null and itemIds.size() > 0'>
-            and t1.item_id in
+            and item_id in
             <foreach collection="itemIds" item="item" separator=","
                      open="(" close=")">
                 #{item}
             </foreach>
 
         </if>
-        group by t1.seller_id
+        group by seller_id ) t1
+        left join(select shop_id as 'shopId', shop_title as 'shopTitle' from kuaishou_activity_open_item_list GROUP BY
+        shop_id)t2
+        on t1.sellerId = t2.shopId
         order by ${fieId} ${sort}