Fancy
2025-01-07 28f6317f7189d5c4a7e64f57dd6c7fc2011f8632
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
package com.dy.pmsOther.fileManage;
 
import com.alibaba.fastjson2.JSON;
import com.dy.common.aop.SsoPowerAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.aop.Log;
import com.dy.pmsGlobal.pojoOth.OthFileManage;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * 上传文件管理
 */
@RestController
@RequestMapping(path = "fileManage")
public class FileManageCtrl {
    private FileManageSv sv;
 
    public FileManageCtrl(FileManageSv sv) {
        this.sv = sv;
    }
 
    @GetMapping(path = "/one")
    @SsoPowerAop(power = "-1")
    @Log("查询单个上传文件")
    public BaseResponse<OthFileManage> one(@RequestParam("id")Long id) {
        OthFileManage file = sv.one(id);
        return BaseResponseUtils.buildSuccess(JSON.toJSON(file));
    }
    /**
     * 分页查询
     * @param vo
     * @return
     */
    @PostMapping(path="some")
    @SsoPowerAop(power = "-1")
    @Log("分页查询上传文件")
    public BaseResponse<QueryResultVo<List<OthFileManage>>> some(@RequestBody QueryVo vo){
        QueryResultVo<List<OthFileManage>> list = sv.selectSome(vo) ;
        return BaseResponseUtils.buildSuccess(list);
    }
 
    @PostMapping(path="save")
    @SsoPowerAop(power = "-1")
    @Log("保存上传文件")
    public BaseResponse<OthFileManage> save(@RequestBody @Valid OthFileManage file) {
        int count =sv.save(file);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        }
        return BaseResponseUtils.buildSuccess(true);
    }
 
    @GetMapping(path="delete")
    @SsoPowerAop(power = "-1")
    @Log("删除上传文件")
    public BaseResponse<OthFileManage> delete(Long id) {
        int count =sv.delete(id);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        }
        return BaseResponseUtils.buildSuccess(true);
    }
 
}