From e9af2e9f07a78b1971d6a32ef0dcb7a52b59b66f Mon Sep 17 00:00:00 2001
From: wangfs <15029758498@163.com>
Date: Sat, 20 Dec 2025 16:30:54 +0800
Subject: [PATCH] 优化
---
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml | 40 ++++++++++++++++++----------------------
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml | 71 +++++++++++++++++++++++++++++++++--------------------------------------
2 files changed, 51 insertions(+), 60 deletions(-)
diff --git a/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml b/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
index 561997d..d6ae343 100644
--- a/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
+++ b/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
@@ -24,11 +24,12 @@
a.finish_state,
a.begin_time,
a.end_time
- FROM garden_inspection_plan a,
- garden_inspection_plan_detail b,
- (select distinct batch_no, dept_id
- from garden_maintain_plan_role
- where deleted = 0
+ FROM
+ garden_inspection_plan a
+ INNER JOIN (
+ SELECT DISTINCT batch_no
+ FROM garden_inspection_plan_role
+ WHERE deleted = 0
AND dept_id = #{req.deptId}
AND role_id IN
@@ -36,14 +37,11 @@
#{roleId}
- ) c
- WHERE a.batch_no = b.batch_no
- AND a.batch_no = c.batch_no
- AND a.dept_id = c.dept_id
- AND a.deleted = b.deleted
- AND a.deleted = 0
+ ) c ON a.batch_no = c.batch_no
+ WHERE
+ a.deleted = 0
- AND a.road_name LIKE CONCAT('%',#{req.roadName},'%')
+ AND a.road_name LIKE CONCAT('%', #{req.roadName}, '%')
AND a.busi_line IN
@@ -51,24 +49,22 @@
#{busiLine}
-
- and b.finish_state = a.finish_state
-
- and a.finish_state = b.finish_state
+
- and a.finish_state = 1
- = #{req.localDate}]]>
+ AND a.finish_state = 1
+ = #{req.localDate}]]>
- and a.finish_state = 2
+ AND a.finish_state = 2
- and a.finish_state = 3
+ AND a.finish_state = 3
- and a.finish_state = 4
+ AND a.finish_state = 4
+
diff --git a/urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml b/urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml
index 28915ff..6c220f0 100644
--- a/urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml
+++ b/urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml
@@ -25,11 +25,11 @@
a.begin_time,
a.end_time
FROM
- garden_maintain_plan a,
- garden_maintain_plan_detail b,
- (select distinct batch_no, dept_id
- from garden_maintain_plan_role
- where deleted = 0
+ garden_maintain_plan a
+ INNER JOIN (
+ SELECT DISTINCT batch_no
+ FROM garden_maintain_plan_role
+ WHERE deleted = 0
AND dept_id = #{req.deptId}
AND role_id IN
@@ -37,38 +37,35 @@
#{roleId}
- ) c
- WHERE a.batch_no = b.batch_no
- AND a.batch_no = c.batch_no
- AND a.dept_id = c.dept_id
- AND a.deleted = b.deleted
- AND a.deleted = 0
-
- AND a.road_name LIKE CONCAT('%',#{req.roadName},'%')
+ ) c ON a.batch_no = c.batch_no
+ WHERE
+ a.deleted = 0
+
+ AND a.road_name LIKE CONCAT('%', #{req.roadName}, '%')
-
AND a.busi_line IN
#{busiLine}
-
- and a.finish_state = b.finish_state
-
- and a.finish_state = 1
- = #{req.localDate}]]>
-
-
- and a.finish_state = 2
-
-
- and a.finish_state = 3
-
-
- and a.finish_state = 4
-
+
+
+
+ AND a.finish_state = 1
+ AND a.begin_time #{req.localDate}
+ AND a.end_time = ]]> #{req.localDate}
+
+
+ AND a.finish_state = 2
+
+
+ AND a.finish_state = 3
+
+
+ AND a.finish_state = 4
+
+
- ) d
- WHERE a.batch_no = c.batch_no
- AND a.batch_no = d.batch_no
- AND a.dept_id = d.dept_id
+ ) d ON c.batch_no = d.batch_no and c.dept_id = d.dept_id
+
AND a.deleted=c.deleted
AND a.deleted=0
AND a.plan_type_id = #{req.planTypeId}
- AND a.plan_type_id LIKE CONCAT('%',#{req.planName},'%')
+ AND a.plan_name LIKE CONCAT('%',#{req.planName},'%')
AND a.busi_line IN
--
libgit2 0.21.4