根据子类id查询所有父类名称

public String getParentName(int nodeID){  
        //和数据库交互,得到当前节点记录  
    	DbRole entity = roleMapper.selectByPrimaryKey(nodeID);  
        if(entity != null){  
            String configName = entity.getB5Name()+"->";  
            //参数patrolConfigEntity.getConfigParentId()表示当前节点的父节点ID  
            String returnConfigName = getParentName(entity.getB5Pid());  
            return returnConfigName+configName;  
        }else{  
            return "";  
        }  
    }

猜你喜欢

转载自blog.csdn.net/qq_41988504/article/details/84888382