parent
e7af18d5b5
commit
e658dd996f
@ -0,0 +1,32 @@
|
|||||||
|
#namespace("Resource")
|
||||||
|
-- 获取指定节点为根的子树
|
||||||
|
#sql("getStructureTree")
|
||||||
|
SELECT structure_id, parent_id FROM t_resource_structure WHERE parent_id = #para(ParentID)
|
||||||
|
UNION ALL
|
||||||
|
SELECT b.structure_id, b.parent_id FROM t_resource_structure b
|
||||||
|
JOIN (SELECT structure_id FROM t_resource_structure WHERE parent_id = #para(ParentID)) AS a ON b.parent_id = a.structure_id
|
||||||
|
UNION ALL
|
||||||
|
SELECT b.structure_id, b.parent_id FROM t_resource_structure b
|
||||||
|
JOIN (SELECT structure_id FROM t_resource_structure WHERE parent_id IN (SELECT structure_id FROM t_resource_base WHERE parent_id = #para(ParentID)))
|
||||||
|
AS a ON b.parent_id = a.structure_id
|
||||||
|
#end
|
||||||
|
-- 资源查询列表
|
||||||
|
#sql("getResourceBaseList")
|
||||||
|
select * from t_resource_base as t1 where 1=1
|
||||||
|
#if(stage_id)
|
||||||
|
and t1.stage_id = #para(stage_id)
|
||||||
|
#end
|
||||||
|
#if(scheme_id)
|
||||||
|
and t1.scheme_id = #para(scheme_id)
|
||||||
|
#end
|
||||||
|
#if(subject_id)
|
||||||
|
and t1.subject_id = #para(subject_id)
|
||||||
|
#end
|
||||||
|
#if(keyword)
|
||||||
|
and t1.resource_name like concat('%',#para(keyword),'%')
|
||||||
|
#end
|
||||||
|
#if(ids)
|
||||||
|
and t1.structure_id in ( #(ids) )
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
Loading…
Reference in new issue