From 32be226bf2637ba78b686c145e0ba571567c02ae Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Wed, 18 Nov 2020 10:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/TestController.java | 2 +- .../lz/modules/flow/dao/StaffRoleMapper.java | 2 ++ .../service/impl/StaffRoleServiceImpl.java | 23 +++++++++++++++---- .../resources/mapper/flow/StaffRoleMapper.xml | 7 +++++- 4 files changed, 28 insertions(+), 6 deletions(-) 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 + + +