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 | 26 | a.end_time |
| 27 | 27 | FROM garden_inspection_plan a, |
| 28 | 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 | 40 | WHERE a.batch_no = b.batch_no |
| 31 | 41 | AND a.batch_no = c.batch_no |
| 32 | 42 | AND a.dept_id = c.dept_id |
| 33 | 43 | AND a.deleted = b.deleted |
| 34 | 44 | AND a.deleted = 0 |
| 35 | - AND a.dept_id = #{req.deptId} | |
| 36 | 45 | <if test="req.roadName != null and req.roadName !=''"> |
| 37 | 46 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') |
| 38 | 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 | 48 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| 46 | 49 | AND a.busi_line IN |
| 47 | 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 | 27 | FROM |
| 28 | 28 | garden_maintain_plan a, |
| 29 | 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 | 41 | WHERE a.batch_no = b.batch_no |
| 32 | 42 | AND a.batch_no = c.batch_no |
| 33 | 43 | AND a.dept_id = c.dept_id |
| 34 | 44 | AND a.deleted = b.deleted |
| 35 | 45 | AND a.deleted = 0 |
| 36 | - AND a.dept_id = #{req.deptId} | |
| 37 | 46 | <if test="req.roadName != null and req.roadName !=''"> |
| 38 | 47 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') |
| 39 | 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 | 50 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| 47 | 51 | AND a.busi_line IN |
| 48 | 52 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> |
| ... | ... | @@ -70,23 +74,26 @@ |
| 70 | 74 | FROM |
| 71 | 75 | garden_maintain_plan a, |
| 72 | 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 | 88 | WHERE a.batch_no = c.batch_no |
| 75 | 89 | AND a.batch_no = d.batch_no |
| 76 | 90 | AND a.dept_id = d.dept_id |
| 77 | 91 | AND a.deleted=c.deleted |
| 78 | 92 | AND a.deleted=0 |
| 79 | - AND a.dept_id = #{req.deptId} | |
| 80 | 93 | AND a.plan_type_id = #{req.planTypeId} |
| 81 | 94 | <if test="req.planName != null and req.planName !=''"> |
| 82 | 95 | AND a.plan_type_id LIKE CONCAT('%',#{req.planName},'%') |
| 83 | 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 | 97 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| 91 | 98 | AND a.busi_line IN |
| 92 | 99 | <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> | ... | ... |