diff --git a/blade-service/blade-demo/src/main/java/com/example/demo/controller/UploadController.java b/blade-service/blade-demo/src/main/java/com/example/demo/controller/UploadController.java index 6d785a522..0353a0da0 100644 --- a/blade-service/blade-demo/src/main/java/com/example/demo/controller/UploadController.java +++ b/blade-service/blade-demo/src/main/java/com/example/demo/controller/UploadController.java @@ -4,6 +4,7 @@ import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import lombok.SneakyThrows; import org.springblade.core.minio.MinioTemplate; +import org.springblade.core.oss.model.BladeFile; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -11,8 +12,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import java.util.Objects; - /** * UploadController * @@ -33,11 +32,10 @@ public class UploadController { * @return String */ @SneakyThrows - @PostMapping("put-minio-object") - public R putMinioObject(@RequestParam MultipartFile file) { - minioTemplate.putFile(file); - String link = minioTemplate.fileLink(Objects.requireNonNull(file.getOriginalFilename())); - return R.data(link); + @PostMapping("put-object") + public R putMinioObject(@RequestParam MultipartFile file) { + BladeFile bladeFile = minioTemplate.putFile(file); + return R.data(bladeFile); } }