首页 > 其他 > 详细

查询运营商的所有下级运营商

时间:2019-03-09 16:16:21      阅读:185      评论:0      收藏:0      [点我收藏+]

技术分享图片

 

/*
     * 
     * 描述:递归查询子运营商id
     * @author heluwei
     * @date 2019年3月7日
     */
    public  List<String> getChild(String id,List<String> list_operator){
        //根据当前运营商id查询所有子运营商的id
        List<String> list = operatorMapper.getNextOperator(id);
        for(int i=0;i<list.size();i++){
            list_operator.add(list.get(i));
            getChild((String)list.get(i),list_operator);//递归查询
        }
        return list_operator ;
    }
/**
     * 
     * 描述:查询运营商的所有子运营商
     * @author heluwei
     * @date 2019年3月9日
     */
    @Override
    public List<Operator> getAllOperator(String operatorId) {
        List<String> tempList = new ArrayList<>();
        // 将父id先存入集合
        tempList.add(operatorId);
        // 递归查找所有子运营商id
        tempList = getChild(operatorId, tempList);
        return allOperator = operatorMapper.getAllOperator(tempList);
    }

 

查询运营商的所有下级运营商

原文:https://www.cnblogs.com/bulrush/p/10501632.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!