FileInfoController.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.migao.controller;
  2. import com.migao.config.response.ResponseBean;
  3. import com.migao.entity.vo.res.FileRes;
  4. import com.migao.service.FileService;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiOperation;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestPart;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import org.springframework.web.multipart.MultipartFile;
  12. import javax.annotation.Resource;
  13. /**
  14. * @author : lcl
  15. * @date : 2020/10/14 9:24
  16. */
  17. @Api(tags = "001.统一上传")
  18. @RestController
  19. @RequestMapping(value = "/file")
  20. public class FileInfoController {
  21. @Resource
  22. private FileService fileInfoService;
  23. @ApiOperation(value = "01.文件统一上传")
  24. @PostMapping(value = "/upload")
  25. public ResponseBean<FileRes> upload(@RequestPart MultipartFile file) {
  26. return fileInfoService.upload(file);
  27. }
  28. @ApiOperation(value = "02.服务器文件同步", hidden = true)
  29. @PostMapping(value = "/serverUpload")
  30. public ResponseBean<FileRes> serverUpload(@RequestPart MultipartFile file) {
  31. return fileInfoService.serverUpload(file);
  32. }
  33. }