云文件系统初始化

This commit is contained in:
2026-04-01 23:50:49 +08:00
parent 32fc36cae1
commit 3107b11bc4
5 changed files with 163 additions and 65 deletions

View File

@@ -497,7 +497,12 @@ public class FileService {
}
file.setFolderId(targetFolderId);
fileMapper.updateById(file);
// 使用直接更新确保 null 值也能被设置
fileMapper.update(null,
new LambdaUpdateWrapper<FileEntity>()
.eq(FileEntity::getId, fileId)
.set(FileEntity::getFolderId, targetFolderId)
);
}
public byte[] createZipArchive(List<Long> fileIds, Long userId) throws IOException {
@@ -558,12 +563,19 @@ public class FileService {
zos.closeEntry();
}
public List<FileEntity> getMovableFolders(Long userId, List<Long> excludeIds) {
public List<FileEntity> getMovableFolders(Long userId, List<Long> excludeIds, Long currentFolderId) {
LambdaQueryWrapper<FileEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FileEntity::getUserId, userId)
.eq(FileEntity::getIsDeleted, 0)
.eq(FileEntity::getIsFolder, 1);
// 只查询当前目录下的文件夹(同级)
if (currentFolderId == null) {
wrapper.isNull(FileEntity::getFolderId);
} else {
wrapper.eq(FileEntity::getFolderId, currentFolderId);
}
if (excludeIds != null && !excludeIds.isEmpty()) {
wrapper.notIn(FileEntity::getId, excludeIds);
}