Java递归实例
/** * 深度向下查询parentId * * @param calltext 调用上下文,必填 * @param parentId 父单元Id * @param parentIds 部门id集 * @return 父部门下所有层级子部门id集合 */ public List<Department> depthFindParentId(String parentId, List<Department> units) { List<Department> departments = _departmentSvc.findByParentId(parentId, null); if (departments!=null && departments.size() > 0) { for (Department dep : departments) { units.add(dep); depthFindParentId(dep.getId(), units); } } return units; }