Browse Source

🎉 优化demo

test
smallchill 5 years ago
parent
commit
04927dba5e
  1. 12
      blade-service/blade-demo/src/main/java/com/example/demo/controller/UploadController.java

12
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<String> putMinioObject(@RequestParam MultipartFile file) {
minioTemplate.putFile(file);
String link = minioTemplate.fileLink(Objects.requireNonNull(file.getOriginalFilename()));
return R.data(link);
@PostMapping("put-object")
public R<BladeFile> putMinioObject(@RequestParam MultipartFile file) {
BladeFile bladeFile = minioTemplate.putFile(file);
return R.data(bladeFile);
}
}

Loading…
Cancel
Save