You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
630 B
22 lines
630 B
9 months ago
|
#namespace("DataEase")
|
||
|
-- 获取树根
|
||
|
#sql("getTreeRoot")
|
||
|
select * from core_dataset_group where name like '云南省教科院项目';
|
||
|
#end
|
||
|
-- 获取所有的数据集
|
||
|
#sql("getAllDataSet")
|
||
|
WITH RECURSIVE tree_cte AS (
|
||
|
SELECT *
|
||
|
FROM core_dataset_group
|
||
|
WHERE id = #para(id) -- 根节点的id
|
||
|
UNION ALL
|
||
|
SELECT c.*
|
||
|
FROM core_dataset_group c
|
||
|
INNER JOIN tree_cte t ON c.pid = t.id
|
||
|
)
|
||
|
SELECT id ,name ,pid,node_type FROM tree_cte
|
||
|
#if(dataset)
|
||
|
where node_type='dataset'
|
||
|
#end
|
||
|
#end
|
||
|
#end
|