根据父级单位数进行排序
Dept dept1 = new Dept();
dept1.setDeptId("X00xx1");
dept1.setDeptName("X00xx1单位名称");
dept1.setAncestors("0,X00001,X00002");
Dept dept2 = new Dept();
dept2.setDeptId("X00262");
dept2.setDeptName("X00262单位名称");
dept2.setAncestors("0,X00001,X00002,X00xx1");
Dept dept3 = new Dept();
dept3.setDeptId("X00263");
dept3.setDeptName("X00263单位名称");
dept3.setAncestors("0,X00001,X00002,X00xx1");
Dept dept4 = new Dept();
dept4.setDeptId("X00002");
dept4.setDeptName("J00002单位名称");
dept4.setAncestors("0,X00001");
List<Dept> deptList = new ArrayList<Dept>();
deptList.add(dept1);
deptList.add(dept2);
deptList.add(dept3);
deptList.add(dept4);
List<Dept> deptList_new = deptList.stream().sorted(Comparator.comparing(Dept::getParentNumber)).collect(Collectors.toList());