diff --git a/src/main/java/com/lz/modules/app/controller/TestController.java b/src/main/java/com/lz/modules/app/controller/TestController.java index 6d1f2fa5..c366c26a 100644 --- a/src/main/java/com/lz/modules/app/controller/TestController.java +++ b/src/main/java/com/lz/modules/app/controller/TestController.java @@ -267,7 +267,7 @@ public class TestController { R r = resultRecordService.initFlowRecord(resultRecordId); } - // http://localhost:8080/lz_management/test/getAuth?userId=395 + // http://localhost:8080/lz_management/test/getAuth?userId=314 @RequestMapping("/test/getAuth") public R getAuth(Long userId) throws Exception{ Map map = staffRoleService.getRoleByUserId(userId); diff --git a/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java b/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java index 6ef6647d..1d9447df 100644 --- a/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java @@ -66,4 +66,6 @@ public interface StaffRoleMapper extends BaseMapper { StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List departmentLevels); + + List selectMenusByParentId(@Param("parentId") long parentId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java index 346c896a..8ac106f1 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java @@ -430,6 +430,10 @@ public class StaffRoleServiceImpl extends ServiceImpl staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType()); if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){ staffMenus.addAll(staffMenuDepartmentList); } } + if(CollectionUtils.isNotEmpty(staffRoleList)){ - List staffMenuList = staffRoleMapper.selectAllMenus(userId); - if(CollectionUtils.isNotEmpty(staffMenuList)){ - staffMenus.addAll(staffMenuList); - } + for(StaffRole staffRole: staffRoleList){ + if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ //如果是主管理员 + List staffMenuList= staffMenuService.selectByParentId( RoleMenuEnums.MASTER_PM.getType()); + if(CollectionUtils.isNotEmpty(staffMenuList)){ + staffMenus.addAll(staffMenuList); + } + }else{ + List staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId()); + if(CollectionUtils.isNotEmpty(staffMenuList)){ + staffMenus.addAll(staffMenuList); + } + } + } } if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){ List authIds = new ArrayList<>(); diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index 19ea3969..1689bd4a 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -169,6 +169,7 @@ select menu_id from lz_staff_role_menu where role_id in ( select id from lz_staff_role where staff_id = #{userId} and is_delete=0) and is_delete = 0 ) and is_delete = 0 + + +