|
@@ -0,0 +1,80 @@
|
|
|
+package org.springblade.business.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.business.entity.MetadataClassification;
|
|
|
+import org.springblade.business.mapper.MetadataClassificationMapper;
|
|
|
+import org.springblade.business.service.IMetadataClassificationService;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/metadata")
|
|
|
+@Api(value = "元数据容器", tags = "元数据容器接口")
|
|
|
+public class MetadataController extends BladeController {
|
|
|
+ private final IMetadataClassificationService iMetadataClassificationService;
|
|
|
+ private final MetadataClassificationMapper metadataClassificationMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/classification/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "元数据容器分类详情", notes = "传入分类类型")
|
|
|
+ public R<IPage<MetadataClassification>> classificationDetail(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
|
|
|
+ IPage<MetadataClassification> page = iMetadataClassificationService.page(Condition.getPage(query), Condition.getQueryWrapper(log, MetadataClassification.class));
|
|
|
+ return R.data(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/classification/submit")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "元数据新增或修改", notes = "传入MetadataClassification")
|
|
|
+ public R<Object> classificationSubmit(@RequestBody MetadataClassification obj) {
|
|
|
+ return R.status(iMetadataClassificationService.classificationSubmit(obj));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(iMetadataClassificationService.deleteLogic(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置分类
|
|
|
+ */
|
|
|
+ @PostMapping("/allocation")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "设置分类", notes = "传入ids")
|
|
|
+ public R allocation(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,@RequestParam String type) {
|
|
|
+ return R.status(iMetadataClassificationService.updateMetadataBytype(Func.toLongList(ids),type));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查看没有设置当前分类的元数据容器
|
|
|
+ */
|
|
|
+ @GetMapping("/allocation/detail")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "元数据容器分类详情", notes = "传入分类类型")
|
|
|
+ public R<IPage<MetadataClassification>> allocationDetail(@ApiIgnore @RequestParam String fileStorage, Query query) {
|
|
|
+ QueryWrapper<MetadataClassification> metadata = new QueryWrapper<>();
|
|
|
+ metadata.lambda().ne(MetadataClassification :: getFileStorageType,fileStorage).eq(MetadataClassification::getIsDeleted,0);
|
|
|
+ IPage<MetadataClassification> page = iMetadataClassificationService.page(Condition.getPage(query), metadata);
|
|
|
+ return R.data(page);
|
|
|
+ }
|
|
|
+}
|