package com.jy.framework.mybatis.join;

import cn.hutool.core.collection.ListUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
public class Select<T> {

    private final Sql<T> sql;

    public Select<T> select(AbstractSql... sqlFormats) {
        sql.selectList.addAll(ListUtil.toList(sqlFormats));
        return this;
    }

    public From<T> from(AbstractTable table) {
        sql.tableList.add(new ConnectTable(SqlConstant.FROM, table));
        return new From<>(sql);
    }

}
