【若依(ruoyi)】部门查询SQL
前言ruoyi 4.6查询某个部门和其子部门SELECT dept_idFROM sys_deptWHERE dept_id = #{deptId} or find_in_set(#{deptId}, ancestors)查询某个部门所在部门树的根节点select dept_idfrom sys_deptwhere parent_id=0and FIND_IN_SET(dept_id ,(sele
·
前言
- ruoyi 4.6
查询某个部门和其子部门
SELECT dept_id
FROM sys_dept
WHERE dept_id = #{deptId} or find_in_set(#{deptId}, ancestors)
查询某个部门所在部门树的根节点
select dept_id
from sys_dept
where parent_id=0
and FIND_IN_SET(dept_id ,(select concat(ancestors, ',', dept_id) from sys_dept where dept_id=#{deptId}))
更多推荐
已为社区贡献94条内容
所有评论(0)