FileController.java 886 B

12345678910111213141516171819202122232425262728293031
  1. package com.gz.controller.system;
  2. import com.gz.core.exception.BusinessException;
  3. import com.gz.dto.system.FileDTO;
  4. import com.gz.service.system.FileService;
  5. import org.springframework.web.bind.annotation.PostMapping;
  6. import org.springframework.web.bind.annotation.RequestBody;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import org.springframework.web.multipart.MultipartFile;
  10. import javax.annotation.Resource;
  11. import java.io.IOException;
  12. /**
  13. * @author LiuchangLan
  14. * @date 2021/2/28 13:39
  15. */
  16. @RestController
  17. @RequestMapping("system/file")
  18. public class FileController {
  19. @Resource
  20. private FileService fileService;
  21. @PostMapping("upload")
  22. public FileDTO upload(@RequestBody MultipartFile file) throws IOException, BusinessException {
  23. return fileService.upload(file);
  24. }
  25. }