提交修改

This commit is contained in:
quyixiao 2020-11-18 10:45:22 +08:00
parent 9f1f70ba4b
commit 32be226bf2
4 changed files with 28 additions and 6 deletions

View File

@ -267,7 +267,7 @@ public class TestController {
R r = resultRecordService.initFlowRecord(resultRecordId); 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") @RequestMapping("/test/getAuth")
public R getAuth(Long userId) throws Exception{ public R getAuth(Long userId) throws Exception{
Map<String,Integer> map = staffRoleService.getRoleByUserId(userId); Map<String,Integer> map = staffRoleService.getRoleByUserId(userId);

View File

@ -66,4 +66,6 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List<String> departmentLevels); StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List<String> departmentLevels);
List<StaffMenu> selectMenusByParentId(@Param("parentId") long parentId);
} }

View File

@ -430,6 +430,10 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel())) { if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel())) {
insertPM(staffRole, RoleMenuEnums.BOSS.getType(), staffEntity); insertPM(staffRole, RoleMenuEnums.BOSS.getType(), staffEntity);
} else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) { } else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
StaffRole masterPM = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
if(masterPM !=null){
return R.error("主管理员只能设置一个,请更改主管理员。");
}
insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity); insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity);
} else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员 } else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员
if(new Long(0).equals(roleModel.getEvaluationGroupId())){//全部考评组 if(new Long(0).equals(roleModel.getEvaluationGroupId())){//全部考评组
@ -485,17 +489,28 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
if(CollectionUtils.isNotEmpty(commonStaffList)){ if(CollectionUtils.isNotEmpty(commonStaffList)){
staffMenus.addAll(commonStaffList); staffMenus.addAll(commonStaffList);
} }
if(new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())){ if(new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())){
List<StaffMenu> staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType()); List<StaffMenu> staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType());
if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){ if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){
staffMenus.addAll(staffMenuDepartmentList); staffMenus.addAll(staffMenuDepartmentList);
} }
} }
if(CollectionUtils.isNotEmpty(staffRoleList)){ if(CollectionUtils.isNotEmpty(staffRoleList)){
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(userId); for(StaffRole staffRole: staffRoleList){
if(CollectionUtils.isNotEmpty(staffMenuList)){ if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ //如果是主管理员
staffMenus.addAll(staffMenuList); List<StaffMenu> staffMenuList= staffMenuService.selectByParentId( RoleMenuEnums.MASTER_PM.getType());
} if(CollectionUtils.isNotEmpty(staffMenuList)){
staffMenus.addAll(staffMenuList);
}
}else{
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId());
if(CollectionUtils.isNotEmpty(staffMenuList)){
staffMenus.addAll(staffMenuList);
}
}
}
} }
if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){ if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){
List<Long> authIds = new ArrayList<>(); List<Long> authIds = new ArrayList<>();

View File

@ -169,6 +169,7 @@
select menu_id from lz_staff_role_menu where role_id in ( 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 select id from lz_staff_role where staff_id = #{userId} and is_delete=0) and is_delete = 0 ) and is_delete = 0
</select> </select>
<select id="selectAllStaffRoleByDepartmentLevel" resultType="com.lz.modules.flow.entity.StaffRole"> <select id="selectAllStaffRoleByDepartmentLevel" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and department_level in select * from lz_staff_role where is_delete = 0 and department_level in
<foreach collection="departmentLevels" item="item" index="index" separator="," open="(" close=")"> <foreach collection="departmentLevels" item="item" index="index" separator="," open="(" close=")">
@ -188,7 +189,11 @@
</select> </select>
<select id="selectAllGroupManageRoles" resultType="StaffRole" > <select id="selectAllGroupManageRoles" resultType="StaffRole" >
select * from lz_staff_role where evaluation_group_id=0 and is_delete=0 and is_delete=0 select * from lz_staff_role where evaluation_group_id=0 and is_delete=0
</select>
<select id="selectMenusByParentId" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where is_delete=0 and parent_id=#{parentId}
</select> </select>