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

 

/*
     * 
     * 描述:递归查询子运营商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);
    }

 

posted @ 2019-03-09 16:10  陆伟  阅读(478)  评论(0编辑  收藏  举报