package com.fdkankan.sale.controller; import com.fdkankan.sale.common.FilePath; import com.fdkankan.sale.common.ResultData; import com.fdkankan.sale.service.impl.UploadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("/sale/upload") public class UploadController { @Autowired UploadService uploadService; @PostMapping("/file") public ResultData file(@RequestParam(required = false) MultipartFile file) throws Exception { return ResultData.ok( uploadService.uploadFile(file)); } }