根据子部门获取其到根部门的路径
/**
* 获取子部门到根部门的路径
* @param orgId String
* @return List<String>
*/
public static List<String> getOrgPath(Long orgId)
{
List<String> paths = new ArrayList<String>();
List<Org> allOrgs = SystemToolKit.getOrgService().getAllSimpleOrg();
Long parentId = orgId;
if (CollectionUtils.isNotEmpty(allOrgs))
{
for (int i = allOrgs.size() - 1; i >= 0; --i)
{
Org node = allOrgs.get(i);
if (!node.getId().equals(parentId))
{
continue;
}
else
{
paths.add(NumberUtils.toString(node.getId()));
parentId = NumberUtils.toLong(node.getParentId());
}
}
}
return paths;
}