diff --git a/blade-service/blade-desk/pom.xml b/blade-service/blade-desk/pom.xml index 34818e23..a933dab0 100644 --- a/blade-service/blade-desk/pom.xml +++ b/blade-service/blade-desk/pom.xml @@ -42,6 +42,11 @@ blade-flow-api ${bladex.project.version} + + org.springblade + blade-starter-minio + ${bladex.tool.version} + diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/UploadController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/UploadController.java new file mode 100644 index 00000000..34e495e0 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/controller/UploadController.java @@ -0,0 +1,38 @@ +package org.springblade.desk.controller; + +import lombok.AllArgsConstructor; +import lombok.SneakyThrows; +import org.springblade.core.minio.MinioTemplate; +import org.springblade.core.tool.api.R; +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; + +/** + * UploadController + * + * @author Chill + */ +@RequestMapping("upload") +@RestController +@AllArgsConstructor +public class UploadController { + + private MinioTemplate minioTemplate; + + /** + * minio上传demo + * + * @param file 上传文件 + * @return + */ + @SneakyThrows + @PostMapping("put-object") + public R putObject(@RequestParam MultipartFile file) { + minioTemplate.putObject("test233", file.getOriginalFilename(), file.getInputStream()); + return R.success("操作成功"); + } + +} diff --git a/blade-service/blade-desk/src/main/resources/application-dev.yml b/blade-service/blade-desk/src/main/resources/application-dev.yml index 5596f784..5d5e709d 100644 --- a/blade-service/blade-desk/src/main/resources/application-dev.yml +++ b/blade-service/blade-desk/src/main/resources/application-dev.yml @@ -7,4 +7,11 @@ spring: datasource: url: ${blade.datasource.dev.url} username: ${blade.datasource.dev.username} - password: ${blade.datasource.dev.password} \ No newline at end of file + password: ${blade.datasource.dev.password} + +minio: + enable: true + tenant-mode: false + endpoint: http://127.0.0.1:9000 + access-key: AZINRTAPCMMWMC9G7F3Z + secret-key: sHl2k4+vvmNaSZZdahUOHQwQDZGZl+4+ajRvBX8d