修改树遍历

This commit is contained in:
huangzj
2023-03-20 15:31:38 +08:00
parent b1bc145e57
commit a99d9febaa

View File

@@ -614,7 +614,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
} }
} }
result = recursion(result,orgdid); result = recursion (result.get (0), orgdid);
return result; return result;
} }
@@ -647,19 +647,23 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
return rSurveyCycleVO; return rSurveyCycleVO;
} }
public List<DeptSubstationVO> recursion ( List<DeptSubstationVO> result,String orgdid){ public List<DeptSubstationVO> recursion(DeptSubstationVO result, String orgdid) {
List<DeptSubstationVO> deptSubstationVOList = new ArrayList<> ( );
if (Objects.equals (result.getId ( ), orgdid)) {
deptSubstationVOList.add (result);
return deptSubstationVOList;
List<DeptSubstationVO> finalResult = new ArrayList<> ();
for (DeptSubstationVO deptSubstationVO : result) {
if(Objects.equals (deptSubstationVO.getId (),orgdid)){
finalResult.add (deptSubstationVO);
return finalResult;
} else { } else {
List<DeptSubstationVO> recursion = recursion (deptSubstationVO.getChildren ( ), orgdid); for (DeptSubstationVO deptSubstationVO : result.getChildren ( )) {
List<DeptSubstationVO> recursion = recursion (deptSubstationVO, orgdid);
if(recursion.size ()>0){
return recursion; return recursion;
} }
} }
return null; }
return deptSubstationVOList;
} }
} }