zss
2025-03-12 3fe5c98e281878451e2e943a393140aa6bfdb996
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
package com.ruoyi.personnel.controller;
 
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.personnel.service.FileGeneralService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
 
@RestController
@Api(tags = "文件通用接口")
@RequestMapping("/fileGeneral")
public class FileGeneralController {
 
    @Autowired
    private FileGeneralService fileGeneralService;
 
    /**
     * 文件上传
     * @param file 文件内容
     * @param suffix 文件后最
     * @param id 绑定表的id
     * @param type 枚举类型
     * @return
     */
 
    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file, String suffix, Integer id,Integer type) {
        fileGeneralService.fileUpload(file, suffix, id,type);
        return Result.success();
    }
 
    /**
     * 文件数据查看
     * @param id 绑定id
     * @param type 枚举类型
     * @return
     */
 
    @GetMapping("/selectFile")
    public Result selectFile(Integer id,Integer type) {
        return Result.success(fileGeneralService.selectFile(id,type));
    }
 
    /**
     * 文件删除
     * @param id 文件id
     * @return
     */
    @GetMapping("/delFile")
    public Result delFile(Integer id) {
        fileGeneralService.delFile(id);
        return Result.success();
    }
 
    /**
     * 文件下载
     * @param id 文件id
     * @return
     */
    @PostMapping("/fileDownLoad")
    public void fileDownLoad(Integer id,HttpServletResponse response) {
        fileGeneralService.fileDownLoad(id,response);
    }
 
 
 
 
 
 
}