public MaterialTypeVo type(long cid,List list){
//MaterialTypeVo materialTypeVo=this.materialTypeRepository.selectById(cid); //->
MaterialTypeVo materialTypeVo=new MaterialTypeVo();
//System.out.println(cid);
for(MaterialTypeVo mat : list){
if(mat.getId()==cid){
materialTypeVo=mat;
//System.out.println(materialTypeVo.getId());
}
}
System.out.println(materialTypeVo);
System.out.println(materialTypeVo.getId());
//List materialTypeVos = this.materialTypeRepository.selectVoByPid(cid); //->
List materialTypeVos=new ArrayList<>();
for(MaterialTypeVo mat : list){
if(mat.getParentId()==cid){
//System.out.println(“da”+cid);
materialTypeVos.add(mat);
}
}
for (MaterialTypeVo typeVo : materialTypeVos) {
MaterialTypeVo n=type(typeVo.getId(),list);
materialTypeVo.getChildren().add(n);
}
//System.out.println(materialTypeVo);
return materialTypeVo;
}