Browse Source

添加上传

test
caoyizhong 2 years ago
parent
commit
50f1239255
  1. 31
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/CommonController.java

31
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<BladeFile> uploadFile(@RequestParam MultipartFile file){
log.info("传入>>>>>>>>>>{}",file);
BladeFile bladeFile = minioTemplate.putFile(file);
return R.data(bladeFile);
}
}
Loading…
Cancel
Save