Commit ab9a74b7bf9e9426e22eab174a280ee0edad8ab3
1 parent
90d81ccd
巡检养护集合增加数据隔离
Showing
6 changed files
with
41 additions
and
3 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanCommitController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 5 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 3 | 6 | import org.springframework.web.bind.annotation.*; |
| 4 | 7 | import jakarta.annotation.Resource; |
| 5 | 8 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -37,6 +40,9 @@ public class InspectionPlanCommitController { |
| 37 | 40 | @Resource |
| 38 | 41 | private InspectionPlanCommitService inspectionPlanCommitService; |
| 39 | 42 | |
| 43 | + @Resource | |
| 44 | + private PermissionApi permissionApi; | |
| 45 | + | |
| 40 | 46 | @PostMapping("/create") |
| 41 | 47 | @Operation(summary = "创建巡检计划提交明细") |
| 42 | 48 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan-commit:create')") |
| ... | ... | @@ -83,6 +89,9 @@ public class InspectionPlanCommitController { |
| 83 | 89 | @Operation(summary = "获得巡检计划提交明细分页") |
| 84 | 90 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan-commit:query')") |
| 85 | 91 | public CommonResult<PageResult<InspectionPlanCommitRespVO>> getInspectionPlanCommitPage(@Valid InspectionPlanCommitPageReqVO pageReqVO) { |
| 92 | + //获取登录人权限 | |
| 93 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 94 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 86 | 95 | PageResult<InspectionPlanCommitRespVO> pageResult = inspectionPlanCommitService.getInspectionPlanCommitPage(pageReqVO); |
| 87 | 96 | return success(BeanUtils.toBean(pageResult, InspectionPlanCommitRespVO.class)); |
| 88 | 97 | } |
| ... | ... | @@ -100,4 +109,4 @@ public class InspectionPlanCommitController { |
| 100 | 109 | BeanUtils.toBean(list, InspectionPlanCommitRespVO.class)); |
| 101 | 110 | } |
| 102 | 111 | |
| 103 | -} | |
| 104 | 112 | \ No newline at end of file |
| 113 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java
| ... | ... | @@ -4,6 +4,7 @@ import lombok.*; |
| 4 | 4 | |
| 5 | 5 | import java.time.LocalDate; |
| 6 | 6 | import java.util.List; |
| 7 | +import java.util.Set; | |
| 7 | 8 | |
| 8 | 9 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | 10 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| ... | ... | @@ -71,4 +72,6 @@ public class InspectionPlanCommitPageReqVO extends PageParam { |
| 71 | 72 | @Schema(description = "创建结束时间") |
| 72 | 73 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 73 | 74 | private LocalDate createTimeEnd; |
| 74 | -} | |
| 75 | 75 | \ No newline at end of file |
| 76 | + | |
| 77 | + private Set<Long> deptIds; | |
| 78 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanCommitController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.maintainplan; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 5 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 3 | 6 | import org.springframework.web.bind.annotation.*; |
| 4 | 7 | import jakarta.annotation.Resource; |
| 5 | 8 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -37,6 +40,10 @@ public class MaintainPlanCommitController { |
| 37 | 40 | @Resource |
| 38 | 41 | private MaintainPlanCommitService maintainPlanCommitService; |
| 39 | 42 | |
| 43 | + @Resource | |
| 44 | + private PermissionApi permissionApi; | |
| 45 | + | |
| 46 | + | |
| 40 | 47 | @PostMapping("/create") |
| 41 | 48 | @Operation(summary = "创建养护计划明细") |
| 42 | 49 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan-commit:create')") |
| ... | ... | @@ -92,6 +99,9 @@ public class MaintainPlanCommitController { |
| 92 | 99 | @Operation(summary = "获得养护计划明细分页") |
| 93 | 100 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan-commit:query')") |
| 94 | 101 | public CommonResult<PageResult<MaintainPlanCommitRespVO>> getMaintainPlanCommitPage(@Valid MaintainPlanCommitPageReqVO pageReqVO) { |
| 102 | + //获取登录人权限 | |
| 103 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 104 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 95 | 105 | PageResult<MaintainPlanCommitRespVO> pageResult = maintainPlanCommitService.getMaintainPlanCommitPage(pageReqVO); |
| 96 | 106 | return success(pageResult); |
| 97 | 107 | } |
| ... | ... | @@ -109,4 +119,4 @@ public class MaintainPlanCommitController { |
| 109 | 119 | BeanUtils.toBean(list, MaintainPlanCommitRespVO.class)); |
| 110 | 120 | } |
| 111 | 121 | |
| 112 | -} | |
| 113 | 122 | \ No newline at end of file |
| 123 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanCommitPageReqVO.java
| ... | ... | @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 7 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 8 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 9 | import java.util.List; |
| 10 | +import java.util.Set; | |
| 10 | 11 | |
| 11 | 12 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| 12 | 13 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| ... | ... | @@ -68,4 +69,5 @@ public class MaintainPlanCommitPageReqVO extends PageParam { |
| 68 | 69 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 69 | 70 | private LocalDate createTimeEnd; |
| 70 | 71 | |
| 72 | + private Set<Long> deptIds; | |
| 71 | 73 | } | ... | ... |
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml
| ... | ... | @@ -94,6 +94,14 @@ |
| 94 | 94 | <if test="req.createTimeEnd != null"> |
| 95 | 95 | <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{req.createTimeEnd}]]> |
| 96 | 96 | </if> |
| 97 | + | |
| 98 | + <if test="req.deptIds != null and !req.deptIds.isEmpty()"> | |
| 99 | + and b.dept_id in | |
| 100 | + <foreach collection="req.deptIds" item="deptId" open="(" separator="," close=")"> | |
| 101 | + #{deptId} | |
| 102 | + </foreach> | |
| 103 | + </if> | |
| 104 | + | |
| 97 | 105 | order by a.id desc |
| 98 | 106 | </select> |
| 99 | 107 | ... | ... |
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanCommitMapper.xml
| ... | ... | @@ -88,6 +88,12 @@ |
| 88 | 88 | <if test="req.createTimeEnd != null"> |
| 89 | 89 | <![CDATA[AND DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{req.createTimeEnd}]]> |
| 90 | 90 | </if> |
| 91 | + <if test="req.deptIds != null and !req.deptIds.isEmpty()"> | |
| 92 | + and b.dept_id in | |
| 93 | + <foreach collection="req.deptIds" item="deptId" open="(" separator="," close=")"> | |
| 94 | + #{deptId} | |
| 95 | + </foreach> | |
| 96 | + </if> | |
| 91 | 97 | order by c.id desc |
| 92 | 98 | </select> |
| 93 | 99 | ... | ... |