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);
|
}
|
}
|