修复删除目录和文件时,数据库记录与本地文件不符的问题

master
Guo XIn 1 year ago
parent de0d51b7ea
commit 83282ad949
  1. 4
      shandan-system/src/main/java/com/keyware/shandan/bianmu/service/impl/DirectoryServiceImpl.java

@ -82,12 +82,12 @@ public class DirectoryServiceImpl extends BaseServiceImpl<DirectoryMapper, Direc
QueryWrapper<DirectoryVo> deleteByResourceIdsQuery = new QueryWrapper<DirectoryVo>();
removeList.forEach(dir -> {
if (dir.getDirectoryType() == DirectoryType.FILE) {
if (countByDirTypeAndResource(DirectoryType.FILE, dir.getResourceId()) == 0) {
if (countByDirTypeAndResource(DirectoryType.FILE, dir.getResourceId()) <= 1) {
deleteByDirectoryIdAndResourceId(null, dir.getResourceId());
sysFileService.deleteById(dir.getResourceId());
}
} else if (dir.getDirectoryType() == DirectoryType.METADATA) {
if (countByDirTypeAndResource(DirectoryType.METADATA, dir.getResourceId()) == 0) {
if (countByDirTypeAndResource(DirectoryType.METADATA, dir.getResourceId()) <= 1) {
deleteByDirectoryIdAndResourceId(null, dir.getResourceId());
}
}