|
@@ -0,0 +1,78 @@
|
|
|
+package com.persagy.adm.diagram.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.persagy.adm.diagram.core.DataStrategy;
|
|
|
+import com.persagy.adm.diagram.core.model.Diagram;
|
|
|
+import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 系统图相关接口
|
|
|
+ *
|
|
|
+ * @author liyang
|
|
|
+ * @date 2022-01-04
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/diagram")
|
|
|
+public class DiagramController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("dataStrategyImpl")
|
|
|
+ private DataStrategy dataStrategy;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 系统图列表接口
|
|
|
+ * 根据系统图类型、项目id、系统实例id、集团code查询
|
|
|
+ *
|
|
|
+ * @param diagram 参数对象
|
|
|
+ * @return 系统图列表
|
|
|
+ */
|
|
|
+ @PostMapping("/list")
|
|
|
+ public CommonResult<List<Diagram>> list(@RequestBody Diagram diagram) {
|
|
|
+ String diagramType = diagram.getType();
|
|
|
+ if (StrUtil.isNotBlank(diagramType)) {
|
|
|
+ return CommonResult.success(dataStrategy.getDiagrams(diagramType, diagram.getProjectId(),
|
|
|
+ diagram.getSystemId(), diagram.getGroupCode()));
|
|
|
+ }
|
|
|
+ return CommonResult.success(dataStrategy.getDiagrams(diagram.getProjectId(), diagram.getSystemId(),
|
|
|
+ diagram.getGroupCode()));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增系统图
|
|
|
+ *
|
|
|
+ * @param diagram 系统图对象信息
|
|
|
+ * @return 是否成功
|
|
|
+ */
|
|
|
+ @PostMapping("/saveDiagram")
|
|
|
+ public CommonResult<Diagram> saveDiagram(@RequestBody Diagram diagram) {
|
|
|
+ return CommonResult.success(dataStrategy.saveDiagram(diagram));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 系统图删除功能
|
|
|
+ *
|
|
|
+ * @param diagramId 系统图id
|
|
|
+ * @return 是否成功
|
|
|
+ */
|
|
|
+ @GetMapping("/deleteDiagram")
|
|
|
+ public CommonResult<Boolean> deleteDiagram(String diagramId) {
|
|
|
+ return CommonResult.success(dataStrategy.deleteDiagram(diagramId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据系统图id获取系统图信息
|
|
|
+ *
|
|
|
+ * @param diagramId 系统图id
|
|
|
+ * @return 系统图对象信息
|
|
|
+ */
|
|
|
+ @GetMapping("/getDiagram")
|
|
|
+ public CommonResult<Diagram> getDiagram(String diagramId) {
|
|
|
+ return CommonResult.success(dataStrategy.getDiagram(diagramId));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|