Commit 9a7689764e32f9ec585dfdf72fa06fc6985c5354

Authored by 王富生
1 parent 9c1c6b8f

优化

urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/vo/AppInspectionPlanPageReqVO.java
... ... @@ -8,7 +8,7 @@ import jakarta.validation.constraints.Min;
8 8 import jakarta.validation.constraints.NotNull;
9 9 import lombok.Data;
10 10  
11   -import java.time.LocalDate;
  11 +import java.time.LocalDateTime;
12 12 import java.util.List;
13 13 import java.util.Set;
14 14  
... ... @@ -40,6 +40,6 @@ public class AppInspectionPlanPageReqVO extends PageParam {
40 40  
41 41 @Schema(description = "系统时间")
42 42 @Hidden
43   - private LocalDate localDate;
  43 + private LocalDateTime localDateTime;
44 44  
45 45 }
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/maintainplan/vo/AppMaintainPlanPageRoadReqVO.java
... ... @@ -8,7 +8,7 @@ import jakarta.validation.constraints.Min;
8 8 import jakarta.validation.constraints.NotNull;
9 9 import lombok.Data;
10 10  
11   -import java.time.LocalDate;
  11 +import java.time.LocalDateTime;
12 12 import java.util.List;
13 13 import java.util.Set;
14 14  
... ... @@ -44,7 +44,7 @@ public class AppMaintainPlanPageRoadReqVO extends PageParam {
44 44  
45 45 @Schema(description = "当前时间")
46 46 @Hidden
47   - private LocalDate localDate;
  47 + private LocalDateTime localDateTime;
48 48  
49 49  
50 50  
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
... ... @@ -370,7 +370,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
370 370 }
371 371 pageReqVO.setDeptId(SecurityFrameworkUtils.getDeptId());
372 372 pageReqVO.setRoleIds(new HashSet<>(roleIds));
373   - pageReqVO.setLocalDate(LocalDate.now());
  373 + pageReqVO.setLocalDateTime(LocalDateTime.now());
374 374 /*2.分页*/
375 375 IPage<AppInspectionPlanRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
376 376 IPage<AppInspectionPlanRespVO> page = inspectionPlanMapper.getInspectionPlanAppPage(mpPage, pageReqVO);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
... ... @@ -384,7 +384,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService {
384 384 }
385 385 pageReqVO.setRoleIds(new HashSet<>(roleIds));
386 386 pageReqVO.setDeptId(SecurityFrameworkUtils.getDeptId());
387   - pageReqVO.setLocalDate(LocalDate.now());
  387 + pageReqVO.setLocalDateTime(LocalDateTime.now());
388 388 /*2.分页*/
389 389 IPage<AppMaintainPlanPageRoadRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
390 390 IPage<AppMaintainPlanPageRoadRespVO> page = maintainPlanMapper.appMaintainPlanRoadPage(mpPage, pageReqVO);
... ...
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanDetailMapper.xml
... ... @@ -45,7 +45,7 @@
45 45 <!--状态 1:未完成;2:已完成;3:已失效-->
46 46 <choose>
47 47 <when test="req.finishState == 1">
48   - AND b.finish_state = 1
  48 + AND b.finish_state=1
49 49 <![CDATA[AND b.begin_time <= #{req.localDateTime}
50 50 AND b.end_time >= #{req.localDateTime}]]>
51 51 </when>
... ...
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
... ... @@ -15,7 +15,8 @@
15 15  
16 16 <select id="getInspectionPlanAppPage" resultType="com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanRespVO">
17 17 SELECT
18   - a.batch_no,
  18 + b.batch_no,
  19 + b.plan_no,
19 20 a.road_id,
20 21 a.road_name,
21 22 a.busi_line,
... ... @@ -25,19 +26,19 @@
25 26 a.begin_time,
26 27 a.end_time
27 28 FROM
28   - garden_inspection_plan a
29   - INNER JOIN (
30   - SELECT DISTINCT batch_no
31   - FROM garden_inspection_plan_role
32   - WHERE deleted = 0
33   - AND dept_id = #{req.deptId}
34   - <if test="req.roleIds != null and req.roleIds.size() > 0">
35   - AND role_id IN
36   - <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")">
37   - #{roleId}
38   - </foreach>
39   - </if>
40   - ) c ON a.batch_no = c.batch_no
  29 + garden_inspection_plan_detail b
  30 + INNER JOIN garden_inspection_plan a ON a.batch_no = b.batch_no
  31 + INNER JOIN (SELECT DISTINCT batch_no
  32 + FROM garden_inspection_plan_role
  33 + WHERE deleted = 0
  34 + AND dept_id = #{req.deptId}
  35 + <if test="req.roleIds != null and req.roleIds.size() > 0">
  36 + AND role_id IN
  37 + <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")">
  38 + #{roleId}
  39 + </foreach>
  40 + </if>
  41 + ) c ON b.batch_no = c.batch_no
41 42 WHERE
42 43 a.deleted = 0
43 44 <if test="req.roadName != null and req.roadName !=''">
... ... @@ -51,18 +52,18 @@
51 52 </if>
52 53 <!-- 状态过滤 -->
53 54 <if test="req.finishState == 1">
54   - AND a.finish_state = 1
55   - <![CDATA[AND a.begin_time <= #{req.localDate}
56   - AND a.end_time >= #{req.localDate}]]>
  55 + AND b.finish_state = 1
  56 + <![CDATA[AND b.begin_time <= #{req.localDateTime}
  57 + AND b.end_time >= #{req.localDateTime}]]>
57 58 </if>
58 59 <if test="req.finishState == 2">
59   - AND a.finish_state = 2
  60 + AND b.finish_state = 2
60 61 </if>
61 62 <if test="req.finishState == 3">
62   - AND a.finish_state = 3
  63 + AND b.finish_state = 3
63 64 </if>
64 65 <if test="req.finishState == 4">
65   - AND a.finish_state = 4
  66 + AND b.finish_state = 4
66 67 </if>
67 68  
68 69  
... ...
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml
... ... @@ -16,16 +16,18 @@
16 16 <select id="appMaintainPlanRoadPage" resultType="com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanPageRoadRespVO">
17 17 SELECT
18 18 a.batch_no,
  19 + b.plan_no,
19 20 a.road_id,
20 21 a.road_name,
21 22 a.level_id,
22 23 a.finish_state,
23 24 a.plan_num,
24 25 a.plan_finish_num,
25   - a.begin_time,
26   - a.end_time
  26 + b.begin_time,
  27 + b.end_time
27 28 FROM
28   - garden_maintain_plan a
  29 + garden_inspection_plan_detail b
  30 + INNER JOIN garden_maintain_plan a ON b.batch_no = a.batch_no and a.deleted = b.deleted
29 31 INNER JOIN (
30 32 SELECT DISTINCT batch_no
31 33 FROM garden_maintain_plan_role
... ... @@ -37,7 +39,7 @@
37 39 #{roleId}
38 40 </foreach>
39 41 </if>
40   - ) c ON a.batch_no = c.batch_no
  42 + ) c ON b.batch_no = c.batch_no
41 43 WHERE
42 44 a.deleted = 0
43 45 <if test="req.roadName != null and req.roadName != ''">
... ... @@ -52,21 +54,21 @@
52 54 <!-- 状态过滤 -->
53 55 <choose>
54 56 <when test="req.finishState == 1">
55   - AND a.finish_state = 1
56   - <![CDATA[AND a.begin_time <= #{req.localDate}
57   - AND a.end_time >= #{req.localDate}]]>
  57 + AND b.finish_state = 1
  58 + <![CDATA[AND b.begin_time <= #{req.localDateTime}
  59 + AND b.end_time >= #{req.localDateTime}]]>
58 60 </when>
59 61 <when test="req.finishState == 2">
60   - AND a.finish_state = 2
  62 + AND b.finish_state = 2
61 63 </when>
62 64 <when test="req.finishState == 3">
63   - AND a.finish_state = 3
  65 + AND b.finish_state = 3
64 66 </when>
65 67 <when test="req.finishState == 4">
66   - AND a.finish_state = 4
  68 + AND b.finish_state = 4
67 69 </when>
68 70 </choose>
69   - ORDER BY a.id desc
  71 + ORDER BY b.id desc
70 72 </select>
71 73  
72 74 <select id="appMaintainPlanPlanTypePage" resultType="com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanPagePlanTypeRespVO">
... ...