mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 21:09:19 +08:00
feat: 新增公司/职位可见权限树接口(只返回已分配权限及其祖先节点)
- PermissionMapper: 新增递归CTE selectAncestorPermissionIds(向上查祖先)
- PermissionService: 新增 getCompanyVisiblePermissionTree / getPositionVisiblePermissionTree
- PermissionServiceImpl: 实现过滤逻辑,只返回 visibleIds 中的节点
- PermissionController: 新增 /permission/tree/company/{id} 和 /permission/tree/position/{id}
- 前端公司/职位权限分配页切换到新的可见树接口
This commit is contained in:
@@ -22,4 +22,19 @@
|
||||
ORDER BY parent_id, sort_order
|
||||
</select>
|
||||
|
||||
<!--
|
||||
递归查询指定权限ID的所有祖先ID(从自己到根节点)
|
||||
用于公司/职位可见权限树过滤
|
||||
-->
|
||||
<select id="selectAncestorPermissionIds" resultType="java.lang.Long">
|
||||
WITH RECURSIVE ancestor_tree AS (
|
||||
SELECT id, parent_id FROM sys_permission WHERE id = #{permissionId}
|
||||
UNION ALL
|
||||
SELECT p.id, p.parent_id
|
||||
FROM sys_permission p
|
||||
INNER JOIN ancestor_tree at ON p.id = at.parent_id
|
||||
)
|
||||
SELECT id FROM ancestor_tree
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user