| | |
| | | package com.ruoyi.system.service.impl.sys; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | } |
| | | userMapper.updateUser(sysUser); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取当前员工权限范围内的员工id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Long> getScopeOfAuthorityUserId() { |
| | | List<Long> userIds = new ArrayList<>(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | SysUser user = this.baseMapper.selectUserById(userId); |
| | | String dataScope = user.getDataScope(); |
| | | //没有配置默认查询自己 |
| | | if(!SecurityUtils.isAdmin(userId) && StringUtils.isEmpty(dataScope)){ |
| | | userIds.add(userId); |
| | | } |
| | | //管理员或者全部权限 |
| | | if(SecurityUtils.isAdmin(userId) || (StringUtils.isNotEmpty(dataScope) && "1".equals(dataScope))){ |
| | | return null; |
| | | } |
| | | //部分权限 |
| | | if(StringUtils.isNotEmpty(dataScope) && "3".equals(dataScope)){ |
| | | SysUser user1 = new SysUser(); |
| | | user1.setUserType("00"); |
| | | user1.setStatus("0"); |
| | | user1.setDeptId(user.getDeptId()); |
| | | List<SysUser> list = this.baseMapper.selectUserList(user1); |
| | | userIds.addAll(list.stream().map(SysUser::getUserId).collect(Collectors.toList())); |
| | | } |
| | | //个人权限 |
| | | if(StringUtils.isNotEmpty(dataScope) && "5".equals(dataScope)){ |
| | | userIds.add(userId); |
| | | } |
| | | return userIds; |
| | | } |
| | | } |