DeptServiceGetSelfAndParentsAsync Method

获取指定子部门及其所有父部门。

Definition

Namespace: QuickAdmin.Service.Admin
Assembly: QuickAdmin.Net (in QuickAdmin.Net.dll) Version: 2.0.10
C#
public virtual Task<SysDept> GetSelfAndParentsAsync(
	long childId,
	int? maxUpLevel = null,
	CancellationToken cancellationToken = default
)

Parameters

childId  long
子部门 Id
maxUpLevel  int?  (Optional)
指示最高反向查询到子部门的第几级父部门,从 1 开始,1 表示到其直接父部门,2 表示到其父部门的父部门,以此类推。
null 表示一直查询到根部门。
cancellationToken  CancellationToken  (Optional)
用于取消操作的令牌。

Return Value

TaskSysDept
返回 childId 对应部门,其父部门依次存储在递归的 Parent 属性中。
childId 对应部门不存在时,将返回 null

Implements

IDeptServiceGetSelfAndParentsAsync(long, int?, CancellationToken)

Remarks

将从 childId 开始,反向递归查询其父部门。

See Also