hyingbo
2025-05-30 5d4112fa1bbd47dc6e7b9c0d239e34b020776924
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
package org.jeecg.modules.system.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.system.entity.FileDocInfo;
import org.jeecg.modules.system.service.IDocInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
@Slf4j
@Api(tags = "文档表")
@RestController
@RequestMapping("/nc/doc")
public class DocInfoController extends JeecgController<FileDocInfo, IDocInfoService> {
    @Autowired
    private IDocInfoService docInfoService;
 
    /**
     * 分页列表查询
     * @param docInfo
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Result<IPage<FileDocInfo>> queryPageList(FileDocInfo docInfo,
                                                    @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                    @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                                    HttpServletRequest req) {
        Result<IPage<FileDocInfo>> result = new Result<IPage<FileDocInfo>>();
        QueryWrapper<FileDocInfo> queryWrapper = QueryGenerator.initQueryWrapper(docInfo, req.getParameterMap());
        Page<FileDocInfo> page = new Page<FileDocInfo>(pageNo, pageSize);
        IPage<FileDocInfo> pageList = docInfoService.page(page, queryWrapper);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }
 
    @AutoLog(value = "文档表-导入文档进口")
    @ApiOperation(value = "文档表-导入文档进口", notes = "文档表-导入文档进口")
    @PostMapping("/add")
    public Result<?> addDocInfo(@RequestParam("file") MultipartFile file) {
        boolean b = docInfoService.addDocInfo(file);
        if(!b)
            return Result.error("操作失败!");
        return Result.ok("操作成功!");
    }
 
    @AutoLog(value = "文档表-删除文档信息")
    @ApiOperation(value = "文档表-删除文档信息", notes = "文档表-删除文档信息")
    @DeleteMapping("/delete")
    public Result<?> deleteDocInfo(@RequestParam("id") String id) {
        boolean b = docInfoService.deleteDocInfo(id);
        if(!b)
            return Result.error("操作失败!");
        return Result.ok("操作成功!");
    }
 
    @AutoLog(value = "文件表-文档下载")
    @ApiOperation(value = "文件表-文档下载", notes = "文件表-文档下载")
    @GetMapping("/download")
    public Result<?> downloadDocFile(@RequestParam("id") String id, HttpServletResponse response) {
        return docInfoService.downloadDocFile(response, id);
    }
}