he2802 1 year ago
parent
commit
75a5fd3462

+ 3 - 5
zhongzheng-system/src/main/resources/mapper/modules/top/TopOldOrderMapper.xml

@@ -2157,15 +2157,13 @@
         (
         SELECT
         `otg`.`order_sn` AS `order_sn`,
-        concat( substr( `otg`.`business_full_name`, 5, 4 ), '-', `otg`.`business_name` ) AS `business_name`,
-        otg.order_goods_id
+        concat( substr( `otg`.`business_full_name`, 5, 4 ), '-', `otg`.`business_name` ) AS `business_name`
         FROM
         `top_old_order_goods` `otg`
         ) ou
         GROUP BY
         ou.order_sn,
-        ou.business_name,
-        ou.order_goods_id
+        ou.business_name
         ) ouu
         LEFT JOIN top_old_order oo ON ouu.order_sn = oo.order_sn
         WHERE
@@ -2200,7 +2198,7 @@
         nou.business_name,
         SUM( nou.goods_received ) AS money,
         2 AS order_type,
-        COUNT( * ) order_num
+        COUNT(DISTINCT nou.order_sn ) order_num
         FROM
         (
         SELECT