fix: 新增文件夹时获取对应类型的最大排序

This commit is contained in:
xiaozzzi 2024-04-04 16:04:44 +08:00
parent 64a8d730a6
commit 1d9b3f66ca

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
@ -98,7 +99,10 @@ public class FolderController {
folder.setUserId(AuthContext.getUserId());
// 如果新增到底部, 获取最大的排序
if (BooleanUtil.isTrue(req.getAddToLast())) {
folder.setSort(docService.selectMaxSortByPid(req.getPid(), AuthContext.getUserId(), FolderTypeEnum.PICTURE) + 1);
folder.setSort(docService.selectMaxSortByPid(
req.getPid(),
AuthContext.getUserId(),
Objects.requireNonNull(FolderTypeEnum.getType(req.getType()))) + 1);
}
return R.ok(baseService.insert(folder));
}