Blame view

urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml 5.34 KB
669cf0a6   王富生   养护假话提交
1
2
3
4
  <?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.inspectionplan.InspectionPlanCommitMapper">
  
ca3eb361   王富生   养护计划优化提交
5
6
  
      <resultMap id="BaseResultMap" type="com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanCommitRespVO">
ea5cef3e   王富生   养护计划优化提交
7
              <result property="imgList" column="img" typeHandler="com.zteits.urbanops.framework.mybatis.core.type.StringArrayToListTypeHandler"/>
ca3eb361   王富生   养护计划优化提交
8
      </resultMap>
669cf0a6   王富生   养护假话提交
9
10
11
12
13
14
      <!--
          一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
          无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
          代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
          文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
       -->
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
15
      <!-- 复杂联表分页查询 -->
ca3eb361   王富生   养护计划优化提交
16
      <select id="selectForPage"  resultMap="BaseResultMap">
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
          SELECT
              a.plan_no,
              b.plan_name,
              a.busi_line,
              b.road_id,
              b.road_name,
              b.level_id,
              b.plan_attr as planAttr,
              b.plan_type_id as planTypeId,
              b.company_id,
              b.dept_id,
              a.img_host as imgHost,
              a.img,
              a.inspection_state as inspectionState,
              a.trans_state as transState,
              a.trans_work_no as transWorkNo,
              a.finish_time as finishTime,
              a.user_id,
              a.user_name,
b759a67e   王富生   材料等级增加来源
36
              a.sort_num,
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
37
38
39
40
41
              a.remark,
              a.creator,
              a.creator_name,
              a.create_time
          FROM
8f9bec32   王富生   优化
42
43
44
              garden_inspection_plan_commit a
              INNER JOIN  garden_inspection_plan b ON a.batch_no = b.batch_no AND  a.deleted= b.deleted
          where a.deleted = 0
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
45
46
47
48
49
50
          <if test="req.planNo != null and req.planNo !=''">
              and a.plan_no = #{req.planNo}
          </if>
          <if test="req.planName != null and req.planName !=''">
              AND b.plan_name  LIKE CONCAT(#{req.planName},'%')
          </if>
2cf45c5d   王富生   测试bug优化
51
          <if test="req.busiLineList != null and req.busiLineList.size() > 0">
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
52
              AND a.busi_line IN
2cf45c5d   王富生   测试bug优化
53
              <foreach collection="req.busiLineList" item="id" open="(" separator="," close=")">
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
54
55
56
                  #{id}
              </foreach>
          </if>
669cf0a6   王富生   养护假话提交
57
  
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
58
59
60
61
62
63
64
65
66
67
68
69
          <if test="req.planAttr != null">
              and b.plan_attr = #{req.planAttr}
          </if>
          <if test="req.planTypeId != null">
              and b.plan_type_id = #{req.planTypeId}
          </if>
          <if test="req.deptId != null">
              and b.dept_id = #{req.deptId}
          </if>
          <if test="req.roadName != null and req.roadName !=''">
              AND b.road_name  LIKE CONCAT(#{req.roadName},'%')
          </if>
398f9230   王富生   道路街道提交
70
          <if test="req.roleName != null and req.roleName !=''">
ebc559ff   王富生   测试bug修复+养护计划明细提交
71
              AND a.role_name LIKE CONCAT(#{req.roleName},'%')
398f9230   王富生   道路街道提交
72
          </if>
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
73
74
75
76
77
78
79
80
81
82
          <if test="req.companyId != null">
              and b.company_id = #{req.companyId}
          </if>
          <if test="req.levelId != null">
              and b.level_id = #{req.levelId}
          </if>
          <if test="req.userName != null and req.userName !=''">
              AND a.user_name  LIKE CONCAT('%', #{req.userName},'%')
          </if>
          <if test="req.transState != null">
2cf45c5d   王富生   测试bug优化
83
              and a.trans_state = #{req.transState}
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
84
85
86
87
88
89
90
          </if>
          <if test="req.finishTime != null">
              AND DATE_FORMAT(a.finish_time, '%Y-%m-%d') = #{req.finishTime}
          </if>
          <if test="req.remark != null and req.remark !=''">
              AND a.remark  LIKE CONCAT('%', #{req.remark} ,'%')
          </if>
11c338b2   王彪总   feat(garden): 增加计...
91
92
93
94
95
96
          <if test="req.createTimeStart != null">
          <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') >= #{req.createTimeStart}]]>
          </if>
          <if test="req.createTimeEnd != null">
          <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{req.createTimeEnd}]]>
          </if>
b3c0caf4   王富生   巡查计划明细及巡查计划创建优化
97
98
          order by a.id desc
      </select>
f43dbd08   王富生   app巡查计划明细提交
99
100
101
102
103
104
105
  
      <select id="appInspectionPlanCommitListByPlanNo" resultType="com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanCommitRespVO">
          SELECT
              a.batch_no,
              b.plan_no,
              a.plan_name,
              a.busi_line,
1c83a3f9   王富生   app养护计划明细提交
106
              c.sort_num,
f43dbd08   王富生   app巡查计划明细提交
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
              a.road_id,
              a.road_name,
              a.plan_attr,
              a.plan_type_id,
              a.rate,
              a.cycle_id,
              b.plan_num,
              b.plan_finish_num,
              b.finish_state,
              c.img_host,
              c.img,
              c.inspection_state,
              c.trans_state,
              c.trans_work_no,
              b.begin_time,
              b.end_time,
              c.user_id,
              c.user_name,
              c.finish_time,
              c.remark
8f9bec32   王富生   优化
127
128
          FROM garden_inspection_plan_detail b
              INNER JOIN garden_inspection_plan a  ON a.batch_no = b.batch_no
9c1c6b8f   王富生   优化
129
             INNER JOIN garden_inspection_plan_commit c ON c.plan_no = b.plan_no AND b.batch_no = c.batch_no
8f9bec32   王富生   优化
130
          WHERE  a.deleted = 0
f43dbd08   王富生   app巡查计划明细提交
131
132
133
134
135
136
137
            AND b.plan_no = #{planNo}
          <if test="busiLineList != null and busiLineList.size() > 0">
              AND a.busi_line IN
              <foreach collection="busiLineList" item="id" open="(" separator="," close=")">
                  #{id}
              </foreach>
          </if>
9c1c6b8f   王富生   优化
138
          ORDER BY c.id DESC
f43dbd08   王富生   app巡查计划明细提交
139
      </select>
11c338b2   王彪总   feat(garden): 增加计...
140
  </mapper>