Commit 579de493824736473614cadd64d0905696ddfd87
1 parent
c71774d1
优化
Showing
2 changed files
with
34 additions
and
24 deletions
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
| @@ -26,22 +26,25 @@ | @@ -26,22 +26,25 @@ | ||
| 26 | a.end_time | 26 | a.end_time |
| 27 | FROM garden_inspection_plan a, | 27 | FROM garden_inspection_plan a, |
| 28 | garden_inspection_plan_detail b, | 28 | garden_inspection_plan_detail b, |
| 29 | - garden_maintain_plan_role c | 29 | + (select distinct batch_no, dept_id |
| 30 | + from garden_maintain_plan_role | ||
| 31 | + where deleted = 0 | ||
| 32 | + AND dept_id = #{req.deptId} | ||
| 33 | + <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 34 | + AND role_id IN | ||
| 35 | + <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 36 | + #{roleId} | ||
| 37 | + </foreach> | ||
| 38 | + </if> | ||
| 39 | + ) c | ||
| 30 | WHERE a.batch_no = b.batch_no | 40 | WHERE a.batch_no = b.batch_no |
| 31 | AND a.batch_no = c.batch_no | 41 | AND a.batch_no = c.batch_no |
| 32 | AND a.dept_id = c.dept_id | 42 | AND a.dept_id = c.dept_id |
| 33 | AND a.deleted = b.deleted | 43 | AND a.deleted = b.deleted |
| 34 | AND a.deleted = 0 | 44 | AND a.deleted = 0 |
| 35 | - AND a.dept_id = #{req.deptId} | ||
| 36 | <if test="req.roadName != null and req.roadName !=''"> | 45 | <if test="req.roadName != null and req.roadName !=''"> |
| 37 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') | 46 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') |
| 38 | </if> | 47 | </if> |
| 39 | - <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 40 | - AND c.role_id IN | ||
| 41 | - <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 42 | - #{roleId} | ||
| 43 | - </foreach> | ||
| 44 | - </if> | ||
| 45 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> | 48 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| 46 | AND a.busi_line IN | 49 | AND a.busi_line IN |
| 47 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> | 50 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> |
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml
| @@ -27,22 +27,26 @@ | @@ -27,22 +27,26 @@ | ||
| 27 | FROM | 27 | FROM |
| 28 | garden_maintain_plan a, | 28 | garden_maintain_plan a, |
| 29 | garden_maintain_plan_detail b, | 29 | garden_maintain_plan_detail b, |
| 30 | - garden_maintain_plan_role c | 30 | + (select distinct batch_no, dept_id |
| 31 | + from garden_maintain_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 | ||
| 31 | WHERE a.batch_no = b.batch_no | 41 | WHERE a.batch_no = b.batch_no |
| 32 | AND a.batch_no = c.batch_no | 42 | AND a.batch_no = c.batch_no |
| 33 | AND a.dept_id = c.dept_id | 43 | AND a.dept_id = c.dept_id |
| 34 | AND a.deleted = b.deleted | 44 | AND a.deleted = b.deleted |
| 35 | AND a.deleted = 0 | 45 | AND a.deleted = 0 |
| 36 | - AND a.dept_id = #{req.deptId} | ||
| 37 | <if test="req.roadName != null and req.roadName !=''"> | 46 | <if test="req.roadName != null and req.roadName !=''"> |
| 38 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') | 47 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') |
| 39 | </if> | 48 | </if> |
| 40 | - <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 41 | - AND c.role_id IN | ||
| 42 | - <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 43 | - #{roleId} | ||
| 44 | - </foreach> | ||
| 45 | - </if> | 49 | + |
| 46 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> | 50 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| 47 | AND a.busi_line IN | 51 | AND a.busi_line IN |
| 48 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> | 52 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> |
| @@ -70,23 +74,26 @@ | @@ -70,23 +74,26 @@ | ||
| 70 | FROM | 74 | FROM |
| 71 | garden_maintain_plan a, | 75 | garden_maintain_plan a, |
| 72 | garden_maintain_plan_detail c, | 76 | garden_maintain_plan_detail c, |
| 73 | - garden_maintain_plan_role d | 77 | + (select distinct batch_no, dept_id |
| 78 | + from garden_maintain_plan_role | ||
| 79 | + where deleted = 0 | ||
| 80 | + AND dept_id = #{req.deptId} | ||
| 81 | + <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 82 | + AND role_id IN | ||
| 83 | + <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 84 | + #{roleId} | ||
| 85 | + </foreach> | ||
| 86 | + </if> | ||
| 87 | + ) d | ||
| 74 | WHERE a.batch_no = c.batch_no | 88 | WHERE a.batch_no = c.batch_no |
| 75 | AND a.batch_no = d.batch_no | 89 | AND a.batch_no = d.batch_no |
| 76 | AND a.dept_id = d.dept_id | 90 | AND a.dept_id = d.dept_id |
| 77 | AND a.deleted=c.deleted | 91 | AND a.deleted=c.deleted |
| 78 | AND a.deleted=0 | 92 | AND a.deleted=0 |
| 79 | - AND a.dept_id = #{req.deptId} | ||
| 80 | AND a.plan_type_id = #{req.planTypeId} | 93 | AND a.plan_type_id = #{req.planTypeId} |
| 81 | <if test="req.planName != null and req.planName !=''"> | 94 | <if test="req.planName != null and req.planName !=''"> |
| 82 | AND a.plan_type_id LIKE CONCAT('%',#{req.planName},'%') | 95 | AND a.plan_type_id LIKE CONCAT('%',#{req.planName},'%') |
| 83 | </if> | 96 | </if> |
| 84 | - <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 85 | - AND d.role_id IN | ||
| 86 | - <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 87 | - #{roleId} | ||
| 88 | - </foreach> | ||
| 89 | - </if> | ||
| 90 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> | 97 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| 91 | AND a.busi_line IN | 98 | AND a.busi_line IN |
| 92 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> | 99 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> |