songhuangfeng123
2022-07-26 300a0fb2b6e0a1255f40db1d618562dd52883e71
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
package com.gkhy.safePlatform.minioDemo.controller;
 
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.minioDemo.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
 
 
@RestController
@RequestMapping(value = "/file")
public class FileController {
 
    @Autowired
    private FileService fileService;
 
    @RequestMapping(value = "/upload",method = RequestMethod.POST)
    public ResultVO uploadFile(@RequestParam MultipartFile file , @RequestParam Integer moduleType){
        return fileService.uploadFile(file,moduleType);
    }
 
    @RequestMapping(value = "/download",method = RequestMethod.GET)
    public void downloadFile(String fileName,HttpServletResponse response){
        fileService.downloadFile(fileName,response);
    }
}