package com.jy.framework.mybatis.join;

public class From<T> extends SqlWrapper<T> {

    protected From(Sql<T> sql) {
        super(sql);
    }

    public Join<T> innerJoin(AbstractTable table) {
        ConnectTable connectTable = new ConnectTable(SqlConstant.INNER_JOIN, table);
        sql.tableList.add(connectTable);
        return new Join<>(this, connectTable);
    }

    public Join<T> leftJoin(AbstractTable table) {
        ConnectTable connectTable = new ConnectTable(SqlConstant.LEFT_JOIN, table);
        sql.tableList.add(connectTable);
        return new Join<>(this, connectTable);
    }

    public Join<T> rightJoin(AbstractTable table) {
        ConnectTable connectTable = new ConnectTable(SqlConstant.RIGHT_JOIN, table);
        sql.tableList.add(connectTable);
        return new Join<>(this, connectTable);
    }

}
