UploadController.java 930 B

1234567891011121314151617181920212223242526
  1. package com.fdkankan.sale.controller;
  2. import com.fdkankan.sale.common.FilePath;
  3. import com.fdkankan.sale.common.ResultData;
  4. import com.fdkankan.sale.service.impl.UploadService;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.beans.factory.annotation.Value;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestParam;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import org.springframework.web.multipart.MultipartFile;
  12. @RestController
  13. @RequestMapping("/sale/upload")
  14. public class UploadController {
  15. @Autowired
  16. UploadService uploadService;
  17. @PostMapping("/file")
  18. public ResultData file(@RequestParam(required = false) MultipartFile file) throws Exception {
  19. return ResultData.ok( uploadService.uploadFile(file));
  20. }
  21. }