刘光辉
5 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
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
package jnpf.dmsController.personal;
 
import jnpf.base.ActionResult;
import jakarta.validation.Valid;
import jnpf.dmsEntity.permission.form.DmsPersonalFolderFavoriteForm;
import jnpf.dmsEntity.permission.vo.DmsPersonalFolderAddResultVO;
import jnpf.dmsEntity.permission.vo.DmsPersonalFolderFileVO;
import jnpf.dmsEntity.permission.vo.DmsPersonalFolderVO;
import jnpf.dmsService.DmsPersonalFolderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
@RestController
@RequestMapping("/personal-folders")
@RequiredArgsConstructor
public class DmsPersonalFolderController {
    private final DmsPersonalFolderService personalFolderService;
 
    @GetMapping("")
    public ActionResult<List<DmsPersonalFolderVO>> folders() {
        return ActionResult.success(personalFolderService.folders());
    }
 
    @GetMapping("/{folderType}/files")
    public ActionResult<List<DmsPersonalFolderFileVO>> files(
            @PathVariable("folderType") String folderType,
            @RequestParam(value = "keyword", required = false) String keyword,
            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        return ActionResult.success(personalFolderService.files(folderType, keyword, pageSize));
    }
 
    @PostMapping("/favorite/files")
    public ActionResult<DmsPersonalFolderAddResultVO> addFavorite(
            @RequestBody @Valid DmsPersonalFolderFavoriteForm form) {
        return ActionResult.success(personalFolderService.addFavoriteSnapshot(form));
    }
}