|
@@ -1,95 +1,105 @@
|
|
|
package com.persagy.adm.diagram.controller;
|
|
|
|
|
|
+import com.persagy.adm.diagram.core.model.Diagram;
|
|
|
import com.persagy.adm.diagram.frame.EditRequest;
|
|
|
import com.persagy.adm.diagram.manage.DemoDiagramManager;
|
|
|
import com.persagy.adm.diagram.manage.Folder;
|
|
|
-import com.persagy.adm.diagram.core.model.Diagram;
|
|
|
import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
import com.persagy.dmp.common.utils.ResultHelper;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
-@CrossOrigin
|
|
|
@RequestMapping("diagram0")
|
|
|
public class DemoDiagramController {
|
|
|
|
|
|
- @Autowired
|
|
|
- private DemoDiagramManager diagramManager;
|
|
|
+ @Autowired
|
|
|
+ private DemoDiagramManager diagramManager;
|
|
|
|
|
|
- /**
|
|
|
- * 查询系统图
|
|
|
- * @param projectId 项目id
|
|
|
- * @param systemId 系统实例id
|
|
|
- * @param groupCode 集团编码
|
|
|
- * @return 树形结构数据(专业-系统-类型-图)
|
|
|
- */
|
|
|
- @ApiOperation("查询系统图,返回树形结构")
|
|
|
- @GetMapping("getDiagrams")
|
|
|
- public CommonResult<List<Folder>> getDiagrams(@RequestParam String projectId,
|
|
|
- @RequestParam(required = false) String systemId,
|
|
|
- @RequestParam(required = false) String groupCode){
|
|
|
- return ResultHelper.single(diagramManager.getDiagrams(projectId, systemId, groupCode));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 查询系统图
|
|
|
+ *
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @param systemId 系统实例id
|
|
|
+ * @param groupCode 集团编码
|
|
|
+ * @return 树形结构数据(专业 - 系统 - 类型 - 图)
|
|
|
+ */
|
|
|
+ @ApiOperation("查询系统图,返回树形结构")
|
|
|
+ @GetMapping("getDiagrams")
|
|
|
+ public CommonResult<List<Folder>> getDiagrams(@RequestParam String projectId,
|
|
|
+ @RequestParam(required = false) String systemId,
|
|
|
+ @RequestParam(required = false) String groupCode) {
|
|
|
+ return ResultHelper.single(diagramManager.getDiagrams(projectId, systemId, groupCode));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 新建系统图
|
|
|
- * @param params 新建参数,对象类型,包含字段 name:名称, type:系统图类型编码
|
|
|
- * @param projectId 项目id
|
|
|
- * @param systemId 系统实例id
|
|
|
- * @param groupCode 集团编码
|
|
|
- * @return 新建的系统图对象
|
|
|
- */
|
|
|
- @PostMapping("newDiagram")
|
|
|
- public CommonResult<Diagram> newDiagram(@RequestBody Map<String, String> params,
|
|
|
- @RequestParam String projectId,
|
|
|
- @RequestParam(required = false) String systemId,
|
|
|
- @RequestParam(required = false) String groupCode){
|
|
|
- return ResultHelper.single(diagramManager.createDiagram(params.get("name"), params.get("type"), projectId, systemId, groupCode));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 新建系统图
|
|
|
+ *
|
|
|
+ * @param params 新建参数,对象类型,包含字段 name:名称, type:系统图类型编码
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @param systemId 系统实例id
|
|
|
+ * @param groupCode 集团编码
|
|
|
+ * @return 新建的系统图对象
|
|
|
+ */
|
|
|
+ @PostMapping("newDiagram")
|
|
|
+ public CommonResult<Diagram> newDiagram(@RequestBody Map<String, String> params,
|
|
|
+ @RequestParam String projectId,
|
|
|
+ @RequestParam(required = false) String systemId,
|
|
|
+ @RequestParam(required = false) String groupCode) {
|
|
|
+ return ResultHelper.single(diagramManager.createDiagram(params.get("name"), params.get("type"), projectId, systemId, groupCode));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 删除系统图
|
|
|
- * @param params 删除参数,对象类型,包含字段 id:系统图id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("delDiagram")
|
|
|
- public CommonResult<Boolean> delDiagram(@RequestBody Map<String, String> params){
|
|
|
- return ResultHelper.single(diagramManager.deleteDiagram(params.get("id")));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 删除系统图
|
|
|
+ *
|
|
|
+ * @param params 删除参数,对象类型,包含字段 id:系统图id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("delDiagram")
|
|
|
+ public CommonResult<Boolean> delDiagram(@RequestBody Map<String, String> params) {
|
|
|
+ return ResultHelper.single(diagramManager.deleteDiagram(params.get("id")));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 设置(修改)系统图使用的模板
|
|
|
- * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id, templateId:使用的模板id
|
|
|
- * @return 系统图对象
|
|
|
- */
|
|
|
- @PostMapping("setTemplate")
|
|
|
- public CommonResult<Diagram> setTemplate(@RequestBody EditRequest req){
|
|
|
- return ResultHelper.single(diagramManager.setTemplate(req.getDiagramId(), req.getTemplateId()));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 设置(修改)系统图使用的模板
|
|
|
+ *
|
|
|
+ * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id, templateId:使用的模板id
|
|
|
+ * @return 系统图对象
|
|
|
+ */
|
|
|
+ @PostMapping("setTemplate")
|
|
|
+ public CommonResult<Diagram> setTemplate(@RequestBody EditRequest req) {
|
|
|
+ return ResultHelper.single(diagramManager.setTemplate(req.getDiagramId(), req.getTemplateId()));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 自动加载数据
|
|
|
- * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id
|
|
|
- * @return 系统图对象
|
|
|
- */
|
|
|
- @PostMapping("loadData")
|
|
|
- public CommonResult<Diagram> loadData(@RequestBody EditRequest req) {
|
|
|
- return ResultHelper.single(diagramManager.loadData(req.getDiagramId(), true));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 自动加载数据
|
|
|
+ *
|
|
|
+ * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id
|
|
|
+ * @return 系统图对象
|
|
|
+ */
|
|
|
+ @PostMapping("loadData")
|
|
|
+ public CommonResult<Diagram> loadData(@RequestBody EditRequest req) {
|
|
|
+ return ResultHelper.single(diagramManager.loadData(req.getDiagramId(), true));
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 保存系统图
|
|
|
- * @param req 编辑参数,对象类型,包含字段 diagram:系统图对象
|
|
|
- * @return 保存后的系统图对象
|
|
|
- */
|
|
|
- @PostMapping("saveDiagram")
|
|
|
- public CommonResult<Diagram> saveDiagram(@RequestBody EditRequest req) {
|
|
|
- return ResultHelper.single(diagramManager.saveDiagram(req.getDiagram()));
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 保存系统图
|
|
|
+ *
|
|
|
+ * @param req 编辑参数,对象类型,包含字段 diagram:系统图对象
|
|
|
+ * @return 保存后的系统图对象
|
|
|
+ */
|
|
|
+ @PostMapping("saveDiagram")
|
|
|
+ public CommonResult<Diagram> saveDiagram(@RequestBody EditRequest req) {
|
|
|
+ return ResultHelper.single(diagramManager.saveDiagram(req.getDiagram()));
|
|
|
+ }
|
|
|
|
|
|
}
|