Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
integration
Commits
7016fa62
Commit
7016fa62
authored
Feb 27, 2026
by
wujipeng
Browse files
获取下游数据
parent
a8d42a77
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/integration/controller/MetaDataController.java
View file @
7016fa62
...
@@ -31,5 +31,11 @@ public class MetaDataController {
...
@@ -31,5 +31,11 @@ public class MetaDataController {
return
Result
.
success
(
metaDataService
.
getUpDataById
(
id
));
return
Result
.
success
(
metaDataService
.
getUpDataById
(
id
));
}
}
@ApiOperation
(
"获取下游数据"
)
@GetMapping
(
"/down/{id}"
)
public
Result
<
List
<
MetaDataVO
>>
getDownDataById
(
@PathVariable
String
id
)
{
return
Result
.
success
(
metaDataService
.
getDownDataById
(
id
));
}
}
}
src/main/java/com/ruzhoukj/integration/mapper/MetaDataMapper.java
View file @
7016fa62
...
@@ -18,4 +18,5 @@ import java.util.List;
...
@@ -18,4 +18,5 @@ import java.util.List;
public
interface
MetaDataMapper
extends
BaseMapper
<
MetaDataEntity
>
{
public
interface
MetaDataMapper
extends
BaseMapper
<
MetaDataEntity
>
{
List
<
MetaDataVO
>
getUpDataById
(
@Param
(
"id"
)
String
id
);
List
<
MetaDataVO
>
getUpDataById
(
@Param
(
"id"
)
String
id
);
List
<
MetaDataVO
>
getDownDataById
(
@Param
(
"id"
)
String
id
);
}
}
src/main/java/com/ruzhoukj/integration/result/Result.java
View file @
7016fa62
...
@@ -32,11 +32,6 @@ public class Result<T> implements Serializable {
...
@@ -32,11 +32,6 @@ public class Result<T> implements Serializable {
*/
*/
private
Long
timestamp
;
private
Long
timestamp
;
/**
* 请求路径
*/
private
String
path
;
/**
/**
* 构造方法
* 构造方法
*/
*/
...
@@ -122,19 +117,5 @@ public class Result<T> implements Serializable {
...
@@ -122,19 +117,5 @@ public class Result<T> implements Serializable {
public
static
<
T
>
Result
<
T
>
ok
(
T
data
,
String
message
)
{
public
static
<
T
>
Result
<
T
>
ok
(
T
data
,
String
message
)
{
return
success
(
data
,
message
);
return
success
(
data
,
message
);
}
}
/**
* 链式调用设置路径
*/
public
Result
<
T
>
path
(
String
path
)
{
this
.
setPath
(
path
);
return
this
;
}
/**
* 判断是否成功
*/
public
Boolean
isSuccess
()
{
return
HttpStatus
.
OK
.
value
()
==
this
.
code
;
}
}
}
\ No newline at end of file
src/main/java/com/ruzhoukj/integration/service/MetaDataService.java
View file @
7016fa62
...
@@ -15,4 +15,7 @@ import java.util.List;
...
@@ -15,4 +15,7 @@ import java.util.List;
public
interface
MetaDataService
extends
IService
<
MetaDataEntity
>
{
public
interface
MetaDataService
extends
IService
<
MetaDataEntity
>
{
List
<
MetaDataVO
>
getUpDataById
(
String
id
);
List
<
MetaDataVO
>
getUpDataById
(
String
id
);
List
<
MetaDataVO
>
getDownDataById
(
String
id
);
}
}
src/main/java/com/ruzhoukj/integration/service/impl/MetaDataServiceImpl.java
View file @
7016fa62
...
@@ -21,4 +21,9 @@ public class MetaDataServiceImpl extends ServiceImpl<MetaDataMapper, MetaDataEnt
...
@@ -21,4 +21,9 @@ public class MetaDataServiceImpl extends ServiceImpl<MetaDataMapper, MetaDataEnt
public
List
<
MetaDataVO
>
getUpDataById
(
String
id
)
{
public
List
<
MetaDataVO
>
getUpDataById
(
String
id
)
{
return
baseMapper
.
getUpDataById
(
id
);
return
baseMapper
.
getUpDataById
(
id
);
}
}
@Override
public
List
<
MetaDataVO
>
getDownDataById
(
String
id
)
{
return
baseMapper
.
getDownDataById
(
id
);
}
}
}
src/main/resources/com/ruzhoukj/integration/mapper/MetaDataMapper.xml
View file @
7016fa62
...
@@ -14,6 +14,35 @@
...
@@ -14,6 +14,35 @@
INNER JOIN downstream d ON m.formula LIKE CONCAT('%{', d.id, '}%')
INNER JOIN downstream d ON m.formula LIKE CONCAT('%{', d.id, '}%')
)
)
SELECT distinct * FROM downstream;
SELECT distinct * FROM downstream;
</select>
<select
id=
"getDownDataById"
resultType=
"com.ruzhoukj.integration.pojo.vo.MetaDataVO"
>
WITH RECURSIVE downstream AS (
SELECT
id,
name,
value,
reunite,
formula,
attribute,
0 AS level,
CAST(NULL AS CHAR(256)) AS parent_id
FROM meta_data
WHERE id = #{id}
UNION ALL
SELECT
m.id,
m.name,
m.value,
m.reunite,
m.formula,
m.attribute,
d.level + 1 AS level,
d.id AS parent_id
FROM meta_data m
INNER JOIN downstream d ON d.formula LIKE CONCAT('%{', m.id, '}%')
)
SELECT * FROM downstream WHERE id != #{id}
</select>
</select>
</mapper>
</mapper>
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