| | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.TDept; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.domain.SysUserPost; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.mapper.SysPostMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import com.ruoyi.system.mapper.SysUserPostMapper; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | |
| | | import javax.validation.Validator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private SysUserMapper userMapper; |
| | | @Autowired |
| | | private TDeptMapper deptMapper; |
| | | |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | Map<Integer, TDept> deptMap = deptMapper.selectList(null).stream() |
| | | .collect(Collectors.toMap(TDept::getId, e->e)); |
| | | for (SysUserVO sysUserVO : list) { |
| | | StringBuilder deptName = new StringBuilder(); |
| | | TDept tDept = deptMap.get(Integer.valueOf(sysUserVO.getDeptId())); |
| | | if (tDept!=null){ |
| | | deptName.append(tDept.getDeptName()); |
| | | while (tDept.getParentId()!=0){ |
| | | tDept = deptMap.get(tDept.getParentId()); |
| | | if (tDept!=null){ |
| | | deptName.append("-").append(tDept.getDeptName()); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | public List<SysUser> selectListByUserIds(List<Integer> userIds) { |
| | | return userMapper.selectListByUserIds(userIds); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUserVO> listByDeptId(Integer deptId, Integer pageNum, Integer pageSize) { |
| | | PageInfo<SysUserVO> pageInfo = new PageInfo<>(pageNum, pageSize); |
| | | List<SysUserVO> list = userMapper.listByDeptId(deptId,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | Map<Integer, TDept> deptMap = deptMapper.selectList(null).stream() |
| | | .collect(Collectors.toMap(TDept::getId, e->e)); |
| | | for (SysUserVO sysUserVO : list) { |
| | | StringBuilder deptName = new StringBuilder(); |
| | | TDept tDept = deptMap.get(Integer.valueOf(sysUserVO.getDeptId())); |
| | | if (tDept!=null){ |
| | | deptName.append(tDept.getDeptName()); |
| | | while (tDept.getParentId()!=0){ |
| | | tDept = deptMap.get(tDept.getParentId()); |
| | | if (tDept!=null){ |
| | | deptName.append("-").append(tDept.getDeptName()); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | } |