postgreSQL ltree工具获取上下级
select * from departments

/*
查询子级部门 path <@ '' 查询上级部门 path @>
path: 部门id用'.'连接
*/
select id,name,path,parent_id from departments where path <@ cast('NE*********Pc.NE*********Pd.NE*********Ra' as ltree)

select * from departments

/*
查询子级部门 path <@ '' 查询上级部门 path @>
path: 部门id用'.'连接
*/
select id,name,path,parent_id from departments where path <@ cast('NE*********Pc.NE*********Pd.NE*********Ra' as ltree)
