yangys
2024-04-04 ed4a5236bab800094be4a8378f5098eebe3de6ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.qianwen.smartman.modules.dnc.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.mp.support.Query;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.secure.BladeUser;
import com.qianwen.core.secure.annotation.PreAuth;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.dnc.service.IFileService;
import com.qianwen.smartman.modules.dnc.vo.FileVO;
import com.qianwen.smartman.modules.dnc.vo.FolderListVO;
import com.qianwen.smartman.modules.dnc.vo.FolderTreeVO;
import com.qianwen.smartman.modules.dnc.vo.FolderVO;
import com.qianwen.smartman.modules.dnc.vo.NewFolderVO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@ApiResource({"blade-dnc/folder"})
@Api(value = "文件夹", tags = {"文件夹"})
@RestController
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/dnc/controller/FolderController.class */
public class FolderController extends BladeController {
    private static final Logger log = LoggerFactory.getLogger(FolderController.class);
    private final IFileService fileService;
 
    public FolderController(final IFileService fileService) {
        this.fileService = fileService;
    }
 
    @PreAuth
    @GetResource({"/lazy"})
    @ApiOperation(value = "文件夹列表(懒加载)", notes = "文件夹列表(懒加载)")
    public R<List<FolderVO>> lazyFolderList(@RequestParam @ApiParam("文件夹Id") String id) {
        BladeUser user = getUser();
        return R.data(this.fileService.lazyFolderList(user.getUserId(), id));
    }
 
    @PreAuth
    @GetResource({"/folder-tree"})
    @ApiOperation(value = "# 查询树结构", notes = "文件树结构")
    public R<List<FolderTreeVO>> folderTree() {
        BladeUser user = getUser();
        return R.data(this.fileService.folderTreeList(user.getUserId()));
    }
 
    @PreAuth
    @PostResource
    @ApiOperation(value = "新建文件夹", notes = "新建文件夹")
    public R<NewFolderVO> create(@RequestBody NewFolderVO vo) {
        BladeUser user = getUser();
        long fileId = this.fileService.createFolder(user, vo).longValue();
        vo.setId(Long.valueOf(fileId));
        return R.data(vo);
    }
 
    @PreAuth
    @GetResource
    @ApiOperation(value = "文件夹下文件以及文件夹", notes = "文件夹下文件以及文件夹")
    public R<FolderListVO> folderList(@RequestParam(required = false) Long parent, @RequestParam(required = false) String searchKey) {
        BladeUser user = getUser();
        return R.data(this.fileService.list(user.getUserId(), parent, searchKey));
    }
 
    @PreAuth
    @GetResource({"/page"})
    @ApiOperation(value = "分页查询文件夹下文件以及文件夹", notes = "分页查询文件夹下文件以及文件夹")
    public R<IPage<FileVO>> folderPage(@RequestParam(required = false) Long parent, @RequestParam(required = false) String searchKey, @RequestParam(required = false) Integer fileType, Query query) {
        BladeUser user = getUser();
        return R.data(this.fileService.page(user.getUserId(), parent, fileType, searchKey, query));
    }
 
    @PreAuth
    @GetResource({"/file-page"})
    @ApiOperation(value = "分页查询文件", notes = "分页查询文件")
    public R<IPage<FileVO>> filePage(@RequestParam(required = false) Long parent, @RequestParam(required = false) String searchKey, @RequestParam(required = false) Integer fileType, Query query) {
        BladeUser user = getUser();
        return R.data(this.fileService.filePage(user.getUserId(), parent, fileType, searchKey, query));
    }
}