he2802 2 lat temu
rodzic
commit
219651ff85

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

@@ -1470,9 +1470,9 @@
     <select id="getSingleTenantStatisticsOrderNum" parameterType="com.zhongzheng.modules.top.order.bo.TopOrderStatisticsBo"
             resultType="java.lang.Long">
         SELECT
-        (IFNULL(COUNT( * ),0)+(
+        (IFNULL(COUNT( DISTINCT order_sn),0)+(
         SELECT
-        IFNULL(COUNT(o.order_id),0) AS orderNum
+        IFNULL(COUNT(DISTINCT o.order_sn),0) AS orderNum
         FROM
         `order` o
         WHERE
@@ -1496,9 +1496,29 @@
         <if test="createSysUserId != null and createSysUserId != ''">
             AND 1=0
         </if>
+        <if test="businessName != null and businessName != ''">
+            AND (
+            SELECT
+            count(*)
+            FROM
+            (
+            SELECT
+            concat( `cet`.`education_name`, '-', `cb`.`business_name`, `cpt`.`project_name` ) AS `business_name`,
+            g.goods_id
+            FROM
+            order_goods og LEFT JOIN  `goods` `g` on og.goods_id = `g`.goods_id
+            LEFT JOIN `course_education_type` `cet` ON `g`.`education_type_id` = `cet`.`id`
+            LEFT JOIN `course_project_type` `cpt` ON `g`.`education_type_id` = `cpt`.`id`
+            LEFT JOIN `course_business` `cb` ON `g`.`business_id` = `cb`.`id`
+            ) oug
+            WHERE
+            o.order_sn = og.order_sn
+            AND oug.business_name = #{businessName}
+            )>0
+        </if>
         ))
         FROM
-        top_old_order
+        top_old_order too
         WHERE
         1 = 1
         AND `status` = 1
@@ -1519,6 +1539,23 @@
         <if test="createSysUserId != null and createSysUserId != ''">
             AND create_sys_user_id = #{createSysUserId}
         </if>
+        <if test="businessName != null and businessName != ''">
+            AND (
+            SELECT
+            count(*)
+            FROM
+            (
+            SELECT
+            `otg`.`order_sn` AS `order_sn`,
+            concat( substr( `otg`.`business_full_name`, 5, 4 ), '-', `otg`.`business_name` ) AS `business_name`
+            FROM
+            `top_old_order_goods` `otg`
+            ) ouu
+            WHERE
+            ouu.order_sn = too.order_sn
+            AND ouu.business_name = #{businessName}
+            ) >0
+        </if>
     </select>
 
     <select id="getNumStatisticsTotalWithBo" parameterType="com.zhongzheng.modules.top.order.bo.TopOrderStatisticsBo"