Commit 90d81ccdca26b36e76baa6936a493b6d40db705b
1 parent
3c5a982c
巡检养护集合增加数据隔离
Showing
6 changed files
with
44 additions
and
28 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 4 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 5 | 6 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 7 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| ... | ... | @@ -125,18 +126,22 @@ public class InspectionPlanController { |
| 125 | 126 | @Operation(summary = "获得巡检计划汇总分页") |
| 126 | 127 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:query')") |
| 127 | 128 | public CommonResult<PageResult<InspectionPlanRespVO>> getInspectionPlanPage(@Valid InspectionPlanPageReqVO pageReqVO) { |
| 128 | - Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 129 | - if(pageReqVO.getCompanyId() == null){ | |
| 130 | - if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 131 | - pageReqVO.setCompanyId( null); | |
| 132 | - }else{ | |
| 133 | - Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 134 | - if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 135 | - companyId = null; | |
| 136 | - } | |
| 137 | - pageReqVO.setCompanyId(companyId); | |
| 138 | - } | |
| 139 | - } | |
| 129 | +// Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 130 | +// if(pageReqVO.getCompanyId() == null){ | |
| 131 | +// if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 132 | +// pageReqVO.setCompanyId( null); | |
| 133 | +// }else{ | |
| 134 | +// Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 135 | +// if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 136 | +// companyId = null; | |
| 137 | +// } | |
| 138 | +// pageReqVO.setCompanyId(companyId); | |
| 139 | +// } | |
| 140 | +// } | |
| 141 | + | |
| 142 | + //获取登录人权限 | |
| 143 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 144 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 140 | 145 | PageResult<InspectionPlanRespVO> pageResult = inspectionPlanService.getInspectionPlanPage(pageReqVO); |
| 141 | 146 | return success(pageResult); |
| 142 | 147 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanPageReqVO.java
| ... | ... | @@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 6 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | 7 | import java.time.LocalDateTime; |
| 8 | +import java.util.Set; | |
| 8 | 9 | |
| 9 | 10 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 10 | 11 | |
| ... | ... | @@ -52,4 +53,5 @@ public class InspectionPlanPageReqVO extends PageParam { |
| 52 | 53 | @Schema(description = "完成状态 : 1:未完成;2:已完成") |
| 53 | 54 | private Integer finishState; |
| 54 | 55 | |
| 55 | -} | |
| 56 | 56 | \ No newline at end of file |
| 57 | + private Set<Long> deptIds; | |
| 58 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.maintainplan; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 4 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 5 | 6 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 7 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| ... | ... | @@ -124,18 +125,21 @@ public class MaintainPlanController { |
| 124 | 125 | @Operation(summary = "获得养护计划汇总分页") |
| 125 | 126 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:query')") |
| 126 | 127 | public CommonResult<PageResult<MaintainPlanRespVO>> getMaintainPlanPage(@Valid MaintainPlanPageReqVO pageReqVO) { |
| 127 | - if(pageReqVO.getCompanyId() == null){ | |
| 128 | - Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 129 | - if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 130 | - pageReqVO.setCompanyId( null); | |
| 131 | - }else{ | |
| 132 | - Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 133 | - if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 134 | - companyId = null; | |
| 135 | - } | |
| 136 | - pageReqVO.setCompanyId(companyId); | |
| 137 | - } | |
| 138 | - } | |
| 128 | +// if(pageReqVO.getCompanyId() == null){ | |
| 129 | +// Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 130 | +// if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 131 | +// pageReqVO.setCompanyId( null); | |
| 132 | +// }else{ | |
| 133 | +// Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 134 | +// if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 135 | +// companyId = null; | |
| 136 | +// } | |
| 137 | +// pageReqVO.setCompanyId(companyId); | |
| 138 | +// } | |
| 139 | +// } | |
| 140 | + //获取登录人权限 | |
| 141 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 142 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 139 | 143 | PageResult<MaintainPlanRespVO> pageResult = maintainPlanService.getMaintainPlanPage(pageReqVO); |
| 140 | 144 | return success(pageResult); |
| 141 | 145 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanPageReqVO.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.time.LocalDateTime; |
| 10 | +import java.util.Set; | |
| 10 | 11 | |
| 11 | 12 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 12 | 13 | |
| ... | ... | @@ -53,4 +54,6 @@ public class MaintainPlanPageReqVO extends PageParam { |
| 53 | 54 | @Schema(description = "完成状态 : 1:未完成;2:已完成") |
| 54 | 55 | private Integer finishState; |
| 55 | 56 | |
| 56 | -} | |
| 57 | 57 | \ No newline at end of file |
| 58 | + private Set<Long> deptIds; | |
| 59 | + | |
| 60 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanInterceptMapper.java
| ... | ... | @@ -31,7 +31,8 @@ public interface InspectionPlanInterceptMapper extends BaseMapperX<InspectionPla |
| 31 | 31 | .eqIfPresent(InspectionPlanDO::getFinishState, reqVO.getFinishState()) |
| 32 | 32 | .betweenIfPresent(InspectionPlanDO::getBeginTime, reqVO.getBeginTime()) |
| 33 | 33 | .betweenIfPresent(InspectionPlanDO::getEndTime, reqVO.getEndTime()) |
| 34 | + .inIfPresent(InspectionPlanDO::getDeptId, reqVO.getDeptIds()) | |
| 34 | 35 | .orderByDesc(InspectionPlanDO::getId)); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | -} | |
| 38 | 38 | \ No newline at end of file |
| 39 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/maintainplan/MaintainPlanInterceptMapper.java
| ... | ... | @@ -33,7 +33,8 @@ public interface MaintainPlanInterceptMapper extends BaseMapperX<MaintainPlanDO> |
| 33 | 33 | .betweenIfPresent(MaintainPlanDO::getBeginTime, reqVO.getBeginTime()) |
| 34 | 34 | .betweenIfPresent(MaintainPlanDO::getEndTime, reqVO.getEndTime()) |
| 35 | 35 | .eq(MaintainPlanDO::getDeleted,0) |
| 36 | + .inIfPresent(MaintainPlanDO::getDeptId, reqVO.getDeptIds()) | |
| 36 | 37 | .orderByDesc(MaintainPlanDO::getId)); |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | -} | |
| 40 | 40 | \ No newline at end of file |
| 41 | +} | ... | ... |