package org.dromara.demo.controller; import io.minio.Result; import org.dromara.common.core.domain.R; import org.dromara.demo.util.MinioUtil; import org.redisson.remote.ResponseEntry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.util.List; @RestController @RequestMapping("/file") public class FileUploadController { @Autowired private MinioUtil minioUtil; @PostMapping("/img") public R uploadMinio(@RequestPart MultipartFile[] file) throws Exception { /*//拿到图片 MultipartFile封装接受的类 //拿到图片的名称 String filename = file.getOriginalFilename(); //拿到图片的 UUId + 图片类型 (解决图片重名的问题 ) String uuid = UUID.randomUUID().toString(); String imgType = filename.substring(filename.lastIndexOf(".")); //图片文件的新名称 xxx/uuid.jpg 图片拼接后的名 String fileName = uuid + imgType;*/ List uploads = minioUtil.uploads(file); return R.ok(uploads.toString()); } }