mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
CreateFolder改修
This commit is contained in:
parent
da8d4fb4fc
commit
68fb0b719b
|
@ -124,19 +124,10 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<String> createFolder(String parentId, String name) {
|
public CompletableFuture<String> createFolder(String parentId, String name) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
|
||||||
FolderEntity parentFolderEntity = database.folderDao().findById(parentId);
|
|
||||||
PublicPath publicPath;
|
|
||||||
if (parentFolderEntity == null) {
|
|
||||||
publicPath = new PublicPath().resolve("/");
|
|
||||||
} else {
|
|
||||||
publicPath = new PublicPath().resolve(parentFolderEntity.publicPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderEntity folderEntity = new FolderEntity();
|
FolderEntity folderEntity = new FolderEntity();
|
||||||
folderEntity.id = UUID.randomUUID().toString();
|
folderEntity.id = UUID.randomUUID().toString();
|
||||||
folderEntity.name = name;
|
folderEntity.name = name;
|
||||||
folderEntity.publicPath = publicPath.getStringPath();
|
folderEntity.parentId = parentId;
|
||||||
database.folderDao().insert(folderEntity);
|
database.folderDao().insert(folderEntity);
|
||||||
return folderEntity.id;
|
return folderEntity.id;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user