private List<From> findFrom(SQLTableSource from) {
        //zhongshu-comment class1.isAssignableFrom(class2) class2是不是class1的子类或者子接口
        //改成用instanceof 应该也行吧：from instanceof SQLExprTableSource
        boolean isSqlExprTable = from.getClass().isAssignableFrom(SQLExprTableSource.class);

        if (isSqlExprTable) {
            SQLExprTableSource fromExpr = (SQLExprTableSource) from;
            String[] split = fromExpr.getExpr().toString().split(",");

            ArrayList<From> fromList = new ArrayList<>();
            for (String source : split) {
                fromList.add(new From(source.trim(), fromExpr.getAlias()));
            }
            return fromList;
        }

        SQLJoinTableSource joinTableSource = ((SQLJoinTableSource) from);
        List<From> fromList = new ArrayList<>();
        fromList.addAll(findFrom(joinTableSource.getLeft()));
        fromList.addAll(findFrom(joinTableSource.getRight()));
        return fromList;
    }
private List < From > findFrom ( SQLTableSource from ) { boolean isSqlExprTable = from . getClass ( ) . isAssignableFrom ( SQLExprTableSource . class ) ; if ( isSqlExprTable ) { SQLExprTableSource fromExpr = ( SQLExprTableSource ) from ; String [ ] split = fromExpr . getExpr ( ) . toString ( ) . split ( "," ) ; ArrayList < From > fromList = new ArrayList < > ( ) ; for ( String source : split ) { fromList . add ( new From ( source . trim ( ) , fromExpr . getAlias ( ) ) ) ; } return fromList ; } SQLJoinTableSource joinTableSource = ( ( SQLJoinTableSource ) from ) ; List < From > fromList = new ArrayList < > ( ) ; fromList . addAll ( findFrom ( joinTableSource . getLeft ( ) ) ) ; fromList . addAll ( findFrom ( joinTableSource . getRight ( ) ) ) ; return fromList ; }
Parse the from clause
zhongshu-comment 只解析了一般查询和join查询，没有解析子查询
@param from the from clause.
@return list of From objects represents all the sources.