Commit 6e837a8a by 翁国栋 Committed by 284718418@qq.com

删除用户下的所有文件

parent 599a63ae
......@@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -406,26 +407,55 @@ public class DiskCatalogueController {
}
/*查找ids第一个*/
diskCatalogueList.forEach(d->{
getSubCatalogueList(d.getId());
d.setDeleteFlag(1);
d.updateById();
});
return ResultUtil.success();
}
private void getSubCatalogueList(Integer id){
List<DiskCatalogue> subFileList =DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>().lambda()
.like(DiskCatalogue::getParentId,id)
.eq(DiskCatalogue::getDeleteFlag,0));
subFileList.forEach(s->{
if(subFileList.size()>0){
getSubCatalogueList(s.getId());
}
List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>().lambda()
.eq(DiskCatalogueFiles::getCatalogueId,s.getId())
.eq(DiskCatalogueFiles::getDeleteFlag,0));
diskCatalogueFilesList.forEach(f->{
DiskFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskFiles>().lambda().eq(DiskFiles::getId,f.getFilesId()));
f.setDeleteFlag(1);
f.updateById();
});
s.setDeleteFlag(1);
s.updateById();
});
}
// private void getSubCatalogueList2(Integer id){
// List<DiskCatalogue> subFileList =DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>().lambda()
// .like(DiskCatalogue::getParentIds,d.getId())
// .like(DiskCatalogue::getParentId,id)
// .eq(DiskCatalogue::getDeleteFlag,0));
// List<DiskCatalogue> subFileList =diskCatalogueService.getSubCatalogueList(d.getId().toString(),diskCatalogueParam.getUserId());
// subFileList.forEach(s->{
// if(subFileList.size()>0){
// getSubCatalogueList(s.getId());
// }
// List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>().lambda()
// .eq(DiskCatalogueFiles::getCatalogueId,s.getId())
// .eq(DiskCatalogueFiles::getDeleteFlag,0));
// diskCatalogueFilesList.forEach(f->{
// DiskFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskFiles>().lambda().eq(DiskFiles::getId,f.getFilesId()));
// });
// if(diskCatalogueFilesList!=null) {
// if(diskCatalogueFilesList.size()>0) {
// diskFilesService.deleteDiskFile(diskCatalogueFilesList.stream().map(DiskCatalogueFiles::getFilesId).collect(Collectors.toList()));
// }
// }
//// diskCatalogueFilesList.forEach(f->{
//// DiskFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskFiles>().lambda().eq(DiskFiles::getId,f.getFilesId()));
//// });
// s.setDeleteFlag(1);
// s.updateById();
// });
d.setDeleteFlag(1);
d.updateById();
});
return ResultUtil.success();
}
// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment