|
@@ -0,0 +1,41 @@
|
|
|
+package com.ruoyi.web.controller.zdsz;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.R;
|
|
|
+import com.ruoyi.framework.obs.ObsService;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 华为obs
|
|
|
+ *
|
|
|
+ * @date 2021-11-24
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/obs")
|
|
|
+public class ObsController extends BaseController {
|
|
|
+ private final ObsService obsService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传文件
|
|
|
+ */
|
|
|
+ @PostMapping
|
|
|
+ public R uploadFile(@RequestBody MultipartFile file) throws Exception {
|
|
|
+ return R.ok(obsService.uploadFile(file));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除文件
|
|
|
+ */
|
|
|
+ @DeleteMapping("/{objectKey}")
|
|
|
+ public R deleteFile(@PathVariable String objectKey) throws Exception {
|
|
|
+ obsService.deleteFile(objectKey);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|