Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neo4jRelation
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qiuchaofei
neo4jRelation
Commits
6333ad25
Commit
6333ad25
authored
May 16, 2022
by
qiuchaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.添加孤立点的算法
parent
f4e9bdf1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
7 deletions
+65
-7
Neo4jConfig.java
...ymobile/metadata/metadataRelation/config/Neo4jConfig.java
+1
-1
DataRelationAnalyController.java
...adataRelation/controller/DataRelationAnalyController.java
+36
-4
Neo4jSystem.java
.../metadata/metadataRelation/pojo/metadata/Neo4jSystem.java
+23
-1
ISchemaService.java
...ile/metadata/metadataRelation/service/ISchemaService.java
+1
-1
ISystemService.java
...ile/metadata/metadataRelation/service/ISystemService.java
+4
-0
No files found.
src/main/java/com/keymobile/metadata/metadataRelation/config/Neo4jConfig.java
View file @
6333ad25
...
@@ -24,7 +24,7 @@ public class Neo4jConfig {
...
@@ -24,7 +24,7 @@ public class Neo4jConfig {
@Bean
(
name
=
"Session"
)
@Bean
(
name
=
"Session"
)
public
Session
getNeo4jSession
()
{
public
Session
getNeo4jSession
()
{
Driver
driver
=
GraphDatabase
.
driver
(
neo4jUrl
,
AuthTokens
.
basic
(
neo4jUsername
,
neo4jPassword
));
Driver
driver
=
GraphDatabase
.
driver
(
neo4jUrl
,
AuthTokens
.
basic
(
neo4jUsername
,
neo4jPassword
));
return
driver
.
session
();
return
driver
.
session
();
}
}
}
}
src/main/java/com/keymobile/metadata/metadataRelation/controller/DataRelationAnalyController.java
View file @
6333ad25
...
@@ -3,6 +3,8 @@ package com.keymobile.metadata.metadataRelation.controller;
...
@@ -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.ReturnNode
;
import
com.keymobile.metadata.metadataRelation.pojo.returnBean.ReturnReslult
;
import
com.keymobile.metadata.metadataRelation.pojo.returnBean.ReturnReslult
;
import
com.keymobile.metadata.metadataRelation.service.DataRelationAnalyService
;
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
com.keymobile.metadata.metadataRelation.service.ITableService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -28,6 +31,13 @@ public class DataRelationAnalyController {
...
@@ -28,6 +31,13 @@ public class DataRelationAnalyController {
@Autowired
@Autowired
private
ITableService
tableService
;
private
ITableService
tableService
;
@Autowired
private
ISchemaService
schemaService
;
@Autowired
private
ISystemService
systemService
;
@ApiOperation
(
tags
=
""
,
value
=
"获取指定表的上下游关系及其字段的上下游关系。"
)
@ApiOperation
(
tags
=
""
,
value
=
"获取指定表的上下游关系及其字段的上下游关系。"
)
@RequestMapping
(
path
=
"/getTableAndColumnRelation"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/getTableAndColumnRelation"
,
method
=
RequestMethod
.
GET
)
public
ReturnReslult
getTableAndColumnRelation
(
String
tableId
)
{
public
ReturnReslult
getTableAndColumnRelation
(
String
tableId
)
{
...
@@ -36,12 +46,34 @@ public class DataRelationAnalyController {
...
@@ -36,12 +46,34 @@ public class DataRelationAnalyController {
return
tableService
.
getTableAndColumnRelation
(
tableId
);
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
)
@RequestMapping
(
path
=
"/getIsolatedNode"
,
method
=
RequestMethod
.
GET
)
public
Map
<
String
,
ReturnNode
>
getIsolatedNode
(
String
parentId
)
{
public
Map
<
String
,
ReturnNode
>
getIsolatedTableBySchema
(
String
parentId
)
{
logger
.
info
(
"查找指定schema下面的孤立点。"
);
logger
.
info
(
"查找指定schema下面的孤立点:"
+
parentId
);
if
(
parentId
==
null
){
return
new
HashMap
<>();
}
return
dataRelationAnalyService
.
findTableWithoutRelations
(
parentId
);
return
dataRelationAnalyService
.
findTableWithoutRelations
(
parentId
);
}
}
...
...
src/main/java/com/keymobile/metadata/metadataRelation/pojo/metadata/Neo4jSystem.java
View file @
6333ad25
...
@@ -3,7 +3,29 @@ package com.keymobile.metadata.metadataRelation.pojo.metadata;
...
@@ -3,7 +3,29 @@ package com.keymobile.metadata.metadataRelation.pojo.metadata;
import
com.keymobile.metadata.metadataRelation.pojo.BaseNode
;
import
com.keymobile.metadata.metadataRelation.pojo.BaseNode
;
import
org.neo4j.ogm.annotation.NodeEntity
;
import
org.neo4j.ogm.annotation.NodeEntity
;
import
java.text.Collator
;
import
java.util.Comparator
;
@NodeEntity
(
label
=
"Neo4jSystem"
)
@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
;
}
}
}
src/main/java/com/keymobile/metadata/metadataRelation/service/ISchemaService.java
View file @
6333ad25
...
@@ -6,7 +6,7 @@ import java.util.List;
...
@@ -6,7 +6,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
public
interface
ISchemaService
{
public
interface
ISchemaService
{
Map
<
String
,
String
>
getSchemaBySystem
(
String
systemId
);
Map
<
String
,
ReturnNode
>
getSchemaBySystemId
(
String
systemId
);
Map
<
String
,
List
<
ReturnNode
>>
getTablesBySchemaId
(
String
schemaId
);
Map
<
String
,
List
<
ReturnNode
>>
getTablesBySchemaId
(
String
schemaId
);
...
...
src/main/java/com/keymobile/metadata/metadataRelation/service/ISystemService.java
View file @
6333ad25
...
@@ -14,4 +14,8 @@ public interface ISystemService {
...
@@ -14,4 +14,8 @@ public interface ISystemService {
Map
<
String
,
List
<
ReturnNode
>>
getEtlJobsBySystemId
(
String
systemId
);
Map
<
String
,
List
<
ReturnNode
>>
getEtlJobsBySystemId
(
String
systemId
);
ReturnReslult
getAllSystem
();
ReturnReslult
getAllSystem
();
//从环境id拿到系统
Map
<
String
,
ReturnNode
>
getSystemByEnvId
(
String
envId
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment