Blame view

urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml 3.95 KB
669cf0a6   王富生   养护假话提交
1
2
3
4
5
6
7
8
9
10
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  <mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanMapper">
  
      <!--
          一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
          无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
          代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
          文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
       -->
04ee424b   王富生   养护计划提交
11
12
13
      <delete id="deleteByBatchNo">
          delete from garden_maintain_plan where batch_no =#{batchNo}
      </delete>
95d30924   王富生   app养护计划明细提交
14
15
16
17
18
19
20
21
22
  
  
      <select id="appMaintainPlanRoadPage" resultType="com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanPageRoadRespVO">
          SELECT
          a.batch_no,
          a.road_id,
          a.road_name,
          a.level_id,
          a.finish_state,
758c32c2   王富生   app养护计划明细提交
23
24
          a.plan_num,
          a.plan_finish_num,
95d30924   王富生   app养护计划明细提交
25
26
27
          a.begin_time,
          a.end_time
          FROM
5b76d9ce   王富生   优化
28
29
          garden_maintain_plan a,
          garden_maintain_plan_detail b,
579de493   王富生   优化
30
31
32
33
34
35
36
37
38
39
40
         (select distinct batch_no, dept_id
          from garden_maintain_plan_role
          where deleted = 0
          AND dept_id = #{req.deptId}
          <if test="req.roleIds != null and req.roleIds.size() > 0">
              AND role_id IN
              <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")">
                  #{roleId}
              </foreach>
          </if>
          )  c
5b76d9ce   王富生   优化
41
42
43
          WHERE a.batch_no = b.batch_no
          AND a.batch_no = c.batch_no
          AND a.dept_id = c.dept_id
49862a55   王彪总   refactor(garden):...
44
          AND a.deleted = b.deleted
5b76d9ce   王富生   优化
45
          AND a.deleted = 0
5b76d9ce   王富生   优化
46
          <if test="req.roadName != null and req.roadName !=''">
95d30924   王富生   app养护计划明细提交
47
48
              AND a.road_name LIKE CONCAT('%',#{req.roadName},'%')
          </if>
579de493   王富生   优化
49
  
95d30924   王富生   app养护计划明细提交
50
51
52
53
54
55
          <if test="req.busiLineList != null and req.busiLineList.size() > 0">
              AND a.busi_line IN
              <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")">
                  #{busiLine}
              </foreach>
          </if>
a5cfb23d   王彪总   临时提交
56
          <!--状态 1:未完成;2:已完成;3:已失效-->
5b76d9ce   王富生   优化
57
58
          and a.finish_state = b.finish_state
          and a.finish_state = #{req.finishState}
95d30924   王富生   app养护计划明细提交
59
60
61
62
      </select>
  
      <select id="appMaintainPlanPlanTypePage" resultType="com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanPagePlanTypeRespVO">
          SELECT
5b76d9ce   王富生   优化
63
64
65
66
67
68
69
70
71
72
73
          c.batch_no,
          c.plan_no,
          a.plan_name,
          a.plan_type_id,
          a.rate,
          a.cycle_id,
          c.plan_num,
          c.plan_finish_num,
          c.finish_state,
          c.begin_time,
          c.end_time
95d30924   王富生   app养护计划明细提交
74
          FROM
5b76d9ce   王富生   优化
75
76
          garden_maintain_plan a,
          garden_maintain_plan_detail c,
579de493   王富生   优化
77
78
79
80
81
82
83
84
85
86
87
          (select distinct batch_no, dept_id
          from garden_maintain_plan_role
          where deleted = 0
          AND dept_id = #{req.deptId}
          <if test="req.roleIds != null and req.roleIds.size() > 0">
              AND role_id IN
              <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")">
                  #{roleId}
              </foreach>
          </if>
          )   d
5b76d9ce   王富生   优化
88
89
90
          WHERE a.batch_no = c.batch_no
          AND a.batch_no = d.batch_no
          AND a.dept_id = d.dept_id
9e5481a8   王富生   修复sq当前时间格式
91
          AND a.deleted=c.deleted
5b76d9ce   王富生   优化
92
          AND a.deleted=0
5b76d9ce   王富生   优化
93
          AND a.plan_type_id = #{req.planTypeId}
95d30924   王富生   app养护计划明细提交
94
95
96
          <if test="req.planName != null and req.planName !=''">
              AND a.plan_type_id LIKE CONCAT('%',#{req.planName},'%')
          </if>
95d30924   王富生   app养护计划明细提交
97
98
99
100
101
102
          <if test="req.busiLineList != null and req.busiLineList.size() > 0">
              AND a.busi_line IN
              <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")">
                  #{busiLine}
              </foreach>
          </if>
a5cfb23d   王彪总   临时提交
103
          <!--状态 1:未完成;2:已完成;3:已失效-->
5b76d9ce   王富生   优化
104
105
          and c.finish_state =a.finish_state
          and c.finish_state = #{req.finishState}
95d30924   王富生   app养护计划明细提交
106
107
      </select>
  
3fdad562   王彪总   feat(garden): 添加计...
108
  </mapper>