Compare commits

..

No commits in common. "5fd43452dec6f16b55b018cc7872735724804320" and "bea84f57c2d231de6f2bc2d2152da73e9b8757d7" have entirely different histories.

3 changed files with 10 additions and 12 deletions

View File

@ -86,7 +86,6 @@ public class FileRecycleServiceImpl implements FileRecycleService {
.orderByAsc(ObjUtil.equals(pars.getFileTypeSort(), 0), EdFileInfo::getSort) .orderByAsc(ObjUtil.equals(pars.getFileTypeSort(), 0), EdFileInfo::getSort)
.orderByDesc(ObjUtil.equals(pars.getFileTypeSort(), 1), EdFileInfo::getSort); .orderByDesc(ObjUtil.equals(pars.getFileTypeSort(), 1), EdFileInfo::getSort);
if (StrUtil.isNotEmpty(pars.getKeyword())) { if (StrUtil.isNotEmpty(pars.getKeyword())) {
queryWrapper.and(qr -> qr.like(EdFileInfo::getFileName, pars.getKeyword()) queryWrapper.and(qr -> qr.like(EdFileInfo::getFileName, pars.getKeyword())
.or() .or()
@ -96,18 +95,17 @@ public class FileRecycleServiceImpl implements FileRecycleService {
.or() .or()
.like(EdFileInfo::getFileContent, pars.getKeyword())); .like(EdFileInfo::getFileContent, pars.getKeyword()));
} }
// TODO 要考虑数据是个人数据还是库数据如果是管理员则展示全部数据其他用户则展示有权限的系统数据+用户个人数据+库数据
if (!UserThreadLocal.getAdminType().equals(AdminTypeEnum.SYSTEM.getValue())) { if (!UserThreadLocal.getAdminType().equals(AdminTypeEnum.SYSTEM.getValue())) {
List<String> ids = edFileInfoMapper.selectList(Wrappers.<EdFileInfo>lambdaQuery().select(EdFileInfo::getId).eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_FILE.code))
.stream()
.map(EdFileInfo::getId)
.collect(Collectors.toList());
List<String> accessibleTree = permissionService.getAccessibleTree(); List<String> accessibleTree = permissionService.getAccessibleTree();
accessibleTree.addAll(ids); queryWrapper.and(qr -> qr.eq(EdFileInfo::getCreatedBy, UserThreadLocal.getUserId()).eq(EdFileInfo::getDataOwn, DataOwnEnum.USER_FILE.code));
if (CollUtil.isNotEmpty(accessibleTree)) { if (CollUtil.isNotEmpty(accessibleTree)) {
queryWrapper.and(qr -> accessibleTree.forEach(e -> qr.or().likeRight(EdFileInfo::getFilePath, e))); for (String permission : accessibleTree) {
queryWrapper.or().likeRight(EdFileInfo::getFileCode, permission);
} }
} }
}
Page<EdFileInfo> edFileInfoPage = this.edFileInfoMapper.selectPage(new Page<>(pars.getPageNum(), pars.getPageSize()), queryWrapper); Page<EdFileInfo> edFileInfoPage = this.edFileInfoMapper.selectPage(new Page<>(pars.getPageNum(), pars.getPageSize()), queryWrapper);
long total = edFileInfoPage.getTotal(); long total = edFileInfoPage.getTotal();
List<FileRecycleQueryVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileRecycleQueryVO.class); List<FileRecycleQueryVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileRecycleQueryVO.class);