| | |
| | | |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return null; |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<NotificationVO> pageListUser(NotificationListQuery query) { |
| | | List<TDept> tDepts = deptMapper.selectList(null); |
| | | Map<Integer, String> deptMap = tDepts.stream().collect(Collectors.toMap(TDept::getId, TDept::getDeptName)); |
| | | if (StringUtils.hasLength(query.getDeptName())){ |
| | | List<Integer> deptIds = deptMapper.selectList(new LambdaQueryWrapper<TDept>().like(TDept::getDeptName, query.getDeptName())) |
| | | .stream().map(TDept::getId).collect(Collectors.toList()); |
| | | if (deptIds.isEmpty()){ |
| | | return new PageInfo<>(); |
| | | } |
| | | query.setDeptIds(deptIds); |
| | | } |
| | | PageInfo<NotificationVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<NotificationVO> list = this.baseMapper.pageListUser(query,pageInfo); |
| | | for (NotificationVO notificationVO : list) { |
| | | StringBuilder deptName = new StringBuilder(); |
| | | if (notificationVO.getType()){ |
| | | for (String deptId : notificationVO.getDeptIds().split(",")) { |
| | | String orDefault = deptMap.getOrDefault(Integer.parseInt(deptId), ""); |
| | | deptName.append(orDefault).append(","); |
| | | } |
| | | notificationVO.setDeptName(deptName.substring(0,deptName.length()-1)); |
| | | }else{ |
| | | notificationVO.setDeptName("全部人员"); |
| | | |
| | | } |
| | | |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |