Commit 1af295e7 by qiuchaofei

1.分页查找孤立点

parent 82f5470f
......@@ -67,14 +67,25 @@ public class DataRelationAnalyController {
return schemaService.getSchemaBySystemId(systemId);
}
@ApiOperation(tags = "", value = "查找指定schema下面的孤立点。parentId参数可以为schemaId,sysemId,evnId")
@ApiOperation(tags = "", value = "全量查找指定节点下面的孤立点。parentId参数可以为schemaId,sysemId,evnId")
@RequestMapping(path = "/getIsolatedNode", method = RequestMethod.GET)
public Map<String, ReturnNode> getIsolatedTableBySchema(String parentId) {
logger.info("查找指定schema下面的孤立点:"+parentId);
if(parentId == null ){
return new HashMap<>();
}
return dataRelationAnalyService.findTableWithoutRelations(parentId,0,200000);
}
@ApiOperation(tags = "", value = "分页查找指定节点的孤立点。parentId参数可以为schemaId,sysemId,evnId")
@RequestMapping(path = "/getIsolatedTableByPage", method = RequestMethod.GET)
public Map<String, ReturnNode> getIsolatedTableByPage(String parentId,int start,int size) {
logger.info("查找指定schema下面的孤立点:"+parentId);
if(parentId == null ){
return new HashMap<>();
}
return dataRelationAnalyService.findTableWithoutRelations(parentId);
return dataRelationAnalyService.findTableWithoutRelations(parentId,start,size);
}
@ApiOperation(tags = "", value = "搜索指定table下面的字段。")
......
......@@ -6,6 +6,6 @@ import java.util.Map;
public interface DataRelationAnalyService {
Map<String, ReturnNode> findTableWithoutRelations(String schemaId);
Map<String, ReturnNode> findTableWithoutRelations(String schemaId,int start,int end);
}
......@@ -25,7 +25,7 @@ public class DataRelationAnalyServiceImpl implements DataRelationAnalyService {
private Session session;
@Override
public Map<String, ReturnNode> findTableWithoutRelations(String parentId) {
public Map<String, ReturnNode> findTableWithoutRelations(String parentId,int start,int end) {
Map<String, ReturnNode> returnNodeMap = new HashMap<>();
//区分传入的id是环境id,系统id还是schema,还是为空,为空则找出所有的孤立点
......@@ -37,12 +37,12 @@ public class DataRelationAnalyServiceImpl implements DataRelationAnalyService {
String condition = "";
if(parentId !=null && parentId .startsWith("System=")){
condition= "<-[r1:Composition]-(:Neo4jSchema)<-[r2:Composition]-(m:Neo4jSystem{metadataId:\""+parentId+"\"})";
cypher = "match (n:Neo4jTable) " + condition + "where not ((n)-[:`流向`]-()) return n";
cypher = "match (n:Neo4jTable) " + condition + "where not ((n)-[:`流向`]-()) return n order by n.name SKIP "+start+" LIMIT "+end+" ";
}else if(parentId !=null && parentId .startsWith("Schema=")){
condition= "<-[r1:Composition]-(m:Neo4jSchema{metadataId:\""+parentId+"\"})";
cypher = "match (n:Neo4jTable) " + condition + "where not ((n)-[:`流向`]-()) return n";
cypher = "match (n:Neo4jTable) " + condition + "where not ((n)-[:`流向`]-()) return n order by n.name SKIP "+start+" LIMIT "+end+" ";
}else if(parentId !=null){
cypher = "match (n:Neo4jTable{isEnvironment:\""+parentId+"\"}) where not ((n)-[:`流向`]-()) return n";
cypher = "match (n:Neo4jTable{isEnvironment:\""+parentId+"\"}) where not ((n)-[:`流向`]-()) return n order by n.name SKIP "+start+" LIMIT "+end+" ";
}
logger .info("查找孤立表的语句:"+cypher);
StatementResult result = session.run(cypher);
......
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