diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java index 5f1e629..6ceb197 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java @@ -382,78 +382,6 @@ public class IReportServiceImpl extends ServiceImpl return list; } -// @Override -// public IPage page(ReportQueryVo vo) { -// IPage page = new Page<>(); -// page.setCurrent(vo.getPageNo()); -// page.setSize(vo.getPageSize()); -// //判断是不是管理员 -// boolean admin = false; -// List roleEOList = roleEODao.selectByuserId(UserUtils.getUserId()); -// for (RoleEO roleEO : roleEOList) { -// if ("管理员".equals(roleEO.getName())){ -// admin= !admin; -// } -// } -// if (admin) { -// vo.setUsid(null); -// } else { -// vo.setUsid(UserUtils.getUserId()); -// } -// -// //按照labelId筛选 -// Set idSet = new HashSet<>(); -// if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { -// LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); -// reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); -// List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); -// reportLabelEntities.forEach(reportLabelEntity -> { -// idSet.add(reportLabelEntity.getReportId()); -// }); -// idSet.add("1"); -// } -// -// -// IPage list = reportDao.page(page, vo,idSet); -// //获取所有报告的labelId -// list.getRecords().forEach((reportVo) -> { -// reportVo.setLabelList(findLabelList(reportVo.getId())); -// }); -// list.getRecords().forEach(c -> { -// FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity()); -// if (StringUtils.isEmpty(fileEntity.getFileType())) { -// c.setFileType(null); -// } -// //ppt文件 -// else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) || -// ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) { -// c.setFileType("1"); -// } -// //excel文件 -// else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) || -// ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) { -// c.setFileType("2"); -// } -// //pdf文件 -// else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) { -// c.setFileType("3"); -// } -// //word文件 -// else { -// c.setFileType("4"); -// } -// -// //文件大小 -// c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize()) -// ? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb"); -// c.setFileName(fileEntity.getFileName()); -// List userIdList = reportUserDao.selectList( -// new QueryWrapper().eq("reportId", c.getId())) -// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList()); -// }); -// return list; -// } - @Override public IPage page(ReportQueryVo vo) { IPage page = new Page<>(); @@ -462,14 +390,16 @@ public class IReportServiceImpl extends ServiceImpl //按照labelId筛选 Set idSet = new HashSet<>(); - if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { + if (CollectionUtils.isNotEmpty(vo.getLabelId())) { LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); - reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); + reportLabelEntityWrapper.in(ReportLabelEntity::getLastLabel, vo.getLabelId()); List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); reportLabelEntities.forEach(reportLabelEntity -> { idSet.add(reportLabelEntity.getReportId()); }); - idSet.add("1"); + if (CollectionUtils.isEmpty(idSet)) { + idSet.add("默认搜索条件"); + } } IPage list = reportDao.page(page, vo, idSet); @@ -555,22 +485,33 @@ public class IReportServiceImpl extends ServiceImpl //按照labelId筛选 Set idSet = new HashSet<>(); - if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) { + if (CollectionUtils.isNotEmpty(vo.getLabelId())) { LambdaQueryWrapper reportLabelEntityWrapper = new LambdaQueryWrapper<>(); - reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId()); + reportLabelEntityWrapper.in(ReportLabelEntity::getLastLabel, vo.getLabelId()); List reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper); reportLabelEntities.forEach(reportLabelEntity -> { idSet.add(reportLabelEntity.getReportId()); }); - idSet.add("1"); + if (CollectionUtils.isEmpty(idSet)) { + idSet.add("默认搜索条件"); + } } IPage list = reportDao.reportManagerPage(page, vo, idSet); - //获取所有报告的labelId - list.getRecords().forEach((reportVo) -> { - reportVo.setLabelList(findLabelList(reportVo.getId())); + //设置标签路径 + list.getRecords().forEach(c -> { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ReportLabelEntity::getReportId, c.getId()); + List reportLabelEntities = reportLabelDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(reportLabelEntities)) { + reportLabelEntities.forEach(reportLabelEntity -> { + c.setLabelList(new ArrayList<>()); + c.getLabelList().add(reportLabelEntity.getLabelId()); + }); + } }); + list.getRecords().forEach(c -> { FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity()); if (StringUtils.isEmpty(fileEntity.getFileType())) { diff --git a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml index 0cc9fd2..d418f2f 100644 --- a/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml +++ b/adc-da-report/src/main/resources/mybatis/mapper/mysql/ReportManageMapper.xml @@ -113,7 +113,6 @@ AVG( trur.user_rating ) AS reportRating FROM TT_REPORT_MANAGE eo - INNER JOIN ts_report_label AS trl ON eo.id = trl.report_id LEFT JOIN ts_user tu ON tu.USID = eo.createUserId LEFT JOIN tr_report_user ru ON eo.id = ru.reportId LEFT JOIN power_apply pa ON pa.report_id = eo.id @@ -168,8 +167,8 @@