diff --git a/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml b/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml
index 6d418bb..147d5e0 100644
--- a/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/yingji/BPlanEnterpriseMapper.xml
@@ -103,23 +103,8 @@
-- WHERE
-- b.USC_CODE IS NOT NULL
-- ) s
- SELECT p.*
+ SELECT s.*
FROM (
- SELECT
- a.*,
- a.planned_year AS plannedYear,
- NULL AS longId,
- NULL AS EXAMINE_START_TIME,
- NULL AS EXAMINE_END_TIME,
-
- 2 AS checkStatus
- FROM
- b_plan_enterprise a
- WHERE
- a.enterprise_id NOT IN (SELECT USC_CODE FROM sz_enfor_examine WHERE USC_CODE IS NOT NULL)
-
- UNION
-
SELECT
a.*,
a.planned_year AS plannedYear,
@@ -130,26 +115,24 @@
CASE
WHEN b.USC_CODE IS NOT NULL AND SUBSTRING(a.planned_year, 1, 7) = SUBSTRING(b.EXAMINE_START_TIME, 1, 7) THEN 1
ELSE 2
- END AS checkStatus
- FROM (
- SELECT *,
- ROW_NUMBER() OVER (PARTITION BY USC_CODE ORDER BY EXAMINE_START_TIME DESC) AS rn
- FROM sz_enfor_examine
- WHERE USC_CODE IS NOT NULL
- ) b
- INNER JOIN b_plan_enterprise a ON a.enterprise_id = b.USC_CODE AND b.rn = 1
- ) p
+ END AS checkStatus,
+ ROW_NUMBER() OVER (PARTITION BY a.enterprise_id ORDER BY b.EXAMINE_START_TIME DESC) AS rn
+ FROM
+ b_plan_enterprise a
+ LEFT JOIN sz_enfor_examine b ON a.enterprise_id = b.USC_CODE AND b.USC_CODE IS NOT NULL
+ ) s
- and p.plannedYear =#{req.plannedYear}
+ and s.plannedYear =#{req.plannedYear}
- and p.district like concat('%', #{req.district}, '%')
+ and s.district like concat('%', #{req.district}, '%')
- and p.checkStatus =#{req.checkStatus}
+ and s.checkStatus =#{req.checkStatus}
+ and s.rn = 1