From 50f1239255c1286392472edf4eed6d4576c160b5 Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Mon, 22 May 2023 16:00:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CommonController.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/CommonController.java diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/CommonController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/CommonController.java new file mode 100644 index 000000000..d5bd74852 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/CommonController.java @@ -0,0 +1,31 @@ +package com.logpm.basicdata.controller; + +import io.swagger.annotations.Api; +import lombok.AllArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.oss.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; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +@RestController +@AllArgsConstructor +@Api(value = "公共",tags = "公共") +@RequestMapping("/common") +@Slf4j +public class CommonController { + + private MinioTemplate minioTemplate; + @SneakyThrows + @PostMapping("/uploadFile") + public R uploadFile(@RequestParam MultipartFile file){ + log.info("传入>>>>>>>>>>{}",file); + BladeFile bladeFile = minioTemplate.putFile(file); + return R.data(bladeFile); + } +}