获取主部门下的所有子部门

xiaoxiao2025-06-08  23

第一次写,呃呃,直接上代码把(本人还是菜鸟,如有不足,求大佬指点)

/** 获取部门下所有员工 * *@param depList 部门id集合 *@return 所有部门id */ private List<Integer> getAllSubDepId(List<Integer> depList){ try{ for(int dep : depList){ //1.这里写你获取下级部门的方法 //2.判断下级是否为空 if(!下级部门id集合.isEmpty()){ depList.addAll(Objects.requireNonNull(this.getAllSubDepId(下级部门id集合))) return depList; } } return depList }catch(Exception e){ return null; } }
转载请注明原文地址: https://www.6miu.com/read-5031480.html

最新回复(0)