he2802 1 年之前
父節點
當前提交
b8c0cb5c74
共有 1 個文件被更改,包括 44 次插入1 次删除
  1. 44 1
      zhongzheng-system/src/main/resources/mapper/modules/top/TopOldOrderMapper.xml

+ 44 - 1
zhongzheng-system/src/main/resources/mapper/modules/top/TopOldOrderMapper.xml

@@ -1852,7 +1852,7 @@
             , create_sys_user_id,any_value(create_username) as create_username
         </if>
         FROM
-        top_old_order
+        top_old_order too
         WHERE
         1 = 1
         AND `status` = 1
@@ -1870,6 +1870,23 @@
         <if test="customerId != null and customerId != ''">
             AND old_customer_id  = #{customerId}
         </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>
         AND tenant_id IS NOT NULL
         GROUP BY
         tenant_id
@@ -1888,6 +1905,12 @@
         FROM
         `order` o
         LEFT JOIN `order_goods` `og` ON o.order_sn = og.order_sn
+        <if test="businessName != null and businessName != ''">
+            LEFT JOIN `goods` `g` ON g.goods_id = og.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`
+        </if>
         WHERE
         o.`status` = 1
         AND o.order_status = 1
@@ -1907,6 +1930,26 @@
         <if test="customerId != null and customerId != ''">
             AND o.old_customer_id  = #{customerId}
         </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
+            `goods` `g`
+            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
+            oug.goods_id = og.goods_id
+            AND oug.business_name = #{businessName}
+            )>0
+        </if>
         AND o.tenant_id IS NOT NULL
         AND og.pay_status != 1
         GROUP BY