OSSController.java 702 B

123456789101112131415161718192021
  1. package io.github.qifan777.knowledge.oss;
  2. import io.qifan.infrastructure.oss.service.OSSService;
  3. import lombok.AllArgsConstructor;
  4. import org.springframework.web.bind.annotation.PostMapping;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import org.springframework.web.multipart.MultipartFile;
  9. @RestController
  10. @RequestMapping("oss")
  11. @AllArgsConstructor
  12. public class OSSController {
  13. private final OSSService ossService;
  14. @PostMapping("upload")
  15. public String upload(@RequestParam MultipartFile file) {
  16. return ossService.upload(file);
  17. }
  18. }