Commit 0ba1df10 by qiuchaofei

添加接口,子节点id找父节点对象

parent b17ef6cf
...@@ -4,6 +4,7 @@ import com.keymobile.metadata.metadataRelation.pojo.returnBean.ReturnNode; ...@@ -4,6 +4,7 @@ import com.keymobile.metadata.metadataRelation.pojo.returnBean.ReturnNode;
import com.keymobile.metadata.metadataRelation.service.DataRelationAnalyService; import com.keymobile.metadata.metadataRelation.service.DataRelationAnalyService;
import com.keymobile.metadata.metadataRelation.service.ITableService; import com.keymobile.metadata.metadataRelation.service.ITableService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,6 +27,7 @@ public class DataRelationAnalyController { ...@@ -26,6 +27,7 @@ public class DataRelationAnalyController {
@Autowired @Autowired
private ITableService tableService; private ITableService tableService;
@ApiOperation(tags = "", value = "查找指定schema下面的孤立点。")
@RequestMapping(path = "/getIsolatedNode", method = RequestMethod.GET) @RequestMapping(path = "/getIsolatedNode", method = RequestMethod.GET)
public Map<String, ReturnNode> getIsolatedNode(String parentId) { public Map<String, ReturnNode> getIsolatedNode(String parentId) {
logger.info("查找指定schema下面的孤立点。"); logger.info("查找指定schema下面的孤立点。");
...@@ -33,10 +35,17 @@ public class DataRelationAnalyController { ...@@ -33,10 +35,17 @@ public class DataRelationAnalyController {
return dataRelationAnalyService.findTableWithoutRelations(parentId); return dataRelationAnalyService.findTableWithoutRelations(parentId);
} }
@ApiOperation(tags = "", value = "搜索指定table下面的字段。")
@RequestMapping(path = "/findColumnByTableIdAndName", method = RequestMethod.GET) @RequestMapping(path = "/findColumnByTableIdAndName", method = RequestMethod.GET)
public Map<String, List<ReturnNode>> findColumnByTableIdAndName(String tableId, String columnName) { public Map<String, List<ReturnNode>> findColumnByTableIdAndName(String tableId, String columnName) {
logger.info("查找指定schema下面的孤立点。表id:"+tableId +" ,给定名字:"+ columnName); logger.info("查找指定。表id:"+tableId +" ,给定名字:"+ columnName);
return tableService.autoMatchBySchemaIdAndInputWord(tableId,columnName); return tableService.autoMatchBySchemaIdAndInputWord(tableId,columnName);
} }
@ApiOperation(tags = "", value = "子节点id找出父节点。")
@RequestMapping(path = "/findParentNodeByChildNodeId", method = RequestMethod.GET)
public Map<String, ReturnNode> findParentNodeByChildNodeId(String childId) {
logger.info("子节点id找出父节点。子节点id:"+childId );
return tableService.getParentByChildId(childId);
}
} }
...@@ -53,4 +53,9 @@ public interface Neo4jTableRepository extends Neo4jRepository<Neo4jTable,Long> { ...@@ -53,4 +53,9 @@ public interface Neo4jTableRepository extends Neo4jRepository<Neo4jTable,Long> {
@Query("match (n:Neo4jTable{metadataId:{tableId}})-[r1:流向]->(m1) return m1 ") @Query("match (n:Neo4jTable{metadataId:{tableId}})-[r1:流向]->(m1) return m1 ")
List<BaseNode> getTargets(@Param("tableId") String tableId); List<BaseNode> getTargets(@Param("tableId") String tableId);
@Query("match (n{metadataId:{tableId}})<-[r1:Composition]-(m1) return m1 ")
List<BaseNode> getParent(@Param("tableId") String tableId);
} }
...@@ -24,4 +24,7 @@ public interface ITableService { ...@@ -24,4 +24,7 @@ public interface ITableService {
ReturnReslult getQualityData(String columnId); ReturnReslult getQualityData(String columnId);
ReturnReslult getRelationAboutTables(String tableId); ReturnReslult getRelationAboutTables(String tableId);
Map<String ,ReturnNode> getParentByChildId(String child);
} }
...@@ -433,6 +433,23 @@ public class TableServiceImpl implements ITableService { ...@@ -433,6 +433,23 @@ public class TableServiceImpl implements ITableService {
return returnReslult; return returnReslult;
} }
@Override
public Map<String, ReturnNode> getParentByChildId(String child) {
Map<String, ReturnNode> parentMap = new HashMap<>();
List<BaseNode> parentList = neo4jTableRepository.getParent(child);
if(parentList !=null && parentList.size()!=0){
for(BaseNode baseNode:parentList){
ReturnNode parentNode = new ReturnNode();
parentNode.setId(baseNode.getMetadataId());
parentNode.setName(baseNode.getName());
parentMap.put(parentNode.getId(),parentNode);
}
}
return parentMap;
}
private void getTargetRelationAboutTables(String metadataId, List<Neo4jTable> targetTableList) { private void getTargetRelationAboutTables(String metadataId, List<Neo4jTable> targetTableList) {
List<BaseNode> targetNodeList = new ArrayList<>(); List<BaseNode> targetNodeList = new ArrayList<>();
if(metadataId.startsWith("ETLScript=")){ if(metadataId.startsWith("ETLScript=")){
......
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