public LinkedList<CommissionUserVO> listAllUpUser(Long userId) {
LinkedList<CommissionUserVO> commissionUserVOLinkedList = new LinkedList<>();
listAllUpUser1(userId,commissionUserVOLinkedList);
return commissionUserVOLinkedList;
}
private LinkedList<CommissionUserVO> listAllUpUser1(Long userId,LinkedList<CommissionUserVO> commissionUserVOLinkedList) {
// 从本级开始
CommissionUserVO parentUser = this.getParentAndUser(userId);
if(commissionUserVOLinkedList.contains(parentUser)){
log.info("重复数据==============parentUser:{}",JSON.toJSON(parentUser));
return commissionUserVOLinkedList;
}
commissionUserVOLinkedList.add(parentUser);
if (parentUser != null && parentUser.getReferrer_id() != null ) {
log.info("parentUser:{}", JSON.toJSON(parentUser));
return listAllUpUser1(parentUser.getReferrer_id(),commissionUserVOLinkedList);
}
return commissionUserVOLinkedList;
}
无限递归查询上级-避免因为数据错误,导致无限递归
最新推荐文章于 2023-11-03 15:58:47 发布