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
1af295e7
Commit
1af295e7
authored
May 17, 2022
by
qiuchaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.分页查找孤立点
parent
82f5470f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
DataRelationAnalyController.java
...adataRelation/controller/DataRelationAnalyController.java
+13
-2
DataRelationAnalyService.java
...ta/metadataRelation/service/DataRelationAnalyService.java
+1
-1
DataRelationAnalyServiceImpl.java
...taRelation/service/impl/DataRelationAnalyServiceImpl.java
+4
-4
No files found.
src/main/java/com/keymobile/metadata/metadataRelation/controller/DataRelationAnalyController.java
View file @
1af295e7
...
...
@@ -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下面的字段。"
)
...
...
src/main/java/com/keymobile/metadata/metadataRelation/service/DataRelationAnalyService.java
View file @
1af295e7
...
...
@@ -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
);
}
src/main/java/com/keymobile/metadata/metadataRelation/service/impl/DataRelationAnalyServiceImpl.java
View file @
1af295e7
...
...
@@ -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
);
...
...
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