Commit 6333ad25 by qiuchaofei

1.添加孤立点的算法

parent f4e9bdf1
......@@ -3,6 +3,8 @@ package com.keymobile.metadata.metadataRelation.controller;
import com.keymobile.metadata.metadataRelation.pojo.returnBean.ReturnNode;
import com.keymobile.metadata.metadataRelation.pojo.returnBean.ReturnReslult;
import com.keymobile.metadata.metadataRelation.service.DataRelationAnalyService;
import com.keymobile.metadata.metadataRelation.service.ISchemaService;
import com.keymobile.metadata.metadataRelation.service.ISystemService;
import com.keymobile.metadata.metadataRelation.service.ITableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -28,6 +31,13 @@ public class DataRelationAnalyController {
@Autowired
private ITableService tableService;
@Autowired
private ISchemaService schemaService;
@Autowired
private ISystemService systemService;
@ApiOperation(tags = "", value = "获取指定表的上下游关系及其字段的上下游关系。")
@RequestMapping(path = "/getTableAndColumnRelation", method = RequestMethod.GET)
public ReturnReslult getTableAndColumnRelation(String tableId) {
......@@ -36,12 +46,34 @@ public class DataRelationAnalyController {
return tableService.getTableAndColumnRelation(tableId);
}
/**
* 孤岛分析 ,查找出孤立表,参数是:环境--系统--schema
* 需要的接口: 从环境获取系统,从系统获取schema
* 全部孤立表,环境下的孤立表,schema的孤立表
* @param envId
* @return
*
*/
@ApiOperation(tags = "", value = "指定环境id获取系统")
@RequestMapping(path = "/getSystemByEnvId", method = RequestMethod.GET)
public Map<String, ReturnNode> getSystemByEnvId(String envId) {
logger.info("指定环境id获取系统:"+envId);
return systemService.getSystemByEnvId(envId);
}
@ApiOperation(tags = "", value = "指定系统id获取schema")
@RequestMapping(path = "/getSystemBySystemId", method = RequestMethod.GET)
public Map<String, ReturnNode> getSchemaBySystemId(String systemId) {
logger.info("指定系统id获取schema{}",systemId);
return schemaService.getSchemaBySystemId(systemId);
}
@ApiOperation(tags = "", value = "查找指定schema下面的孤立点。")
@ApiOperation(tags = "", value = "查找指定schema下面的孤立点。parentId参数可以为schemaId,sysemId,evnId")
@RequestMapping(path = "/getIsolatedNode", method = RequestMethod.GET)
public Map<String, ReturnNode> getIsolatedNode(String parentId) {
logger.info("查找指定schema下面的孤立点。");
public Map<String, ReturnNode> getIsolatedTableBySchema(String parentId) {
logger.info("查找指定schema下面的孤立点:"+parentId);
if(parentId == null ){
return new HashMap<>();
}
return dataRelationAnalyService.findTableWithoutRelations(parentId);
}
......
......@@ -3,7 +3,29 @@ package com.keymobile.metadata.metadataRelation.pojo.metadata;
import com.keymobile.metadata.metadataRelation.pojo.BaseNode;
import org.neo4j.ogm.annotation.NodeEntity;
import java.text.Collator;
import java.util.Comparator;
@NodeEntity(label = "Neo4jSystem")
public class Neo4jSystem extends BaseNode {
public class Neo4jSystem extends BaseNode implements Comparable<Neo4jSystem>{
@Override
public int compareTo(Neo4jSystem neo4jSystem) {
//先按照name排序
Integer i = this.getName().compareTo(neo4jSystem.getName());
if (i == 0) {
//如果Name相等,则按照id排序
i = this.getId().compareTo(neo4jSystem.getId());
if (i == 0) {
//如果id相等,则按照CnName排序
i = this.getCnName().compareTo(neo4jSystem.getCnName());
}
}
/**
* i等于0的时候表示相等;
* i等于1的时候表示大于;
* i等于-1的时候表示小于;
*/
return i;
}
}
......@@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map;
public interface ISchemaService {
Map<String,String> getSchemaBySystem(String systemId);
Map<String,ReturnNode> getSchemaBySystemId(String systemId);
Map<String, List<ReturnNode>> getTablesBySchemaId(String schemaId);
......
......@@ -14,4 +14,8 @@ public interface ISystemService {
Map<String ,List<ReturnNode>> getEtlJobsBySystemId(String systemId);
ReturnReslult getAllSystem();
//从环境id拿到系统
Map<String ,ReturnNode> getSystemByEnvId(String envId);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment