
package com.lideeyunji.tool.framework.sql.build.buildmodel.dql;


import com.lideeyunji.tool.framework.sql.build.ISQLExpression;
import com.lideeyunji.tool.framework.sql.build.build.dql.BuildSelect;
import com.lideeyunji.tool.framework.sql.build.buildmodel.SqlInfoBaseModel;
import com.lideeyunji.tool.framework.sql.core.model.SqlFormatModel;

/**
 * @author JX
 * @create 2024-07-03 11:51
 * @dedescription:
 */
public class SqlInfoSelectModel<T> extends SqlInfoBaseModel {

    private String tableName;

    private String[] columns;

    public static Builder builder(){
        return new Builder();
    }


    public static class Builder {
        private SqlInfoSelectModel selectModel = new SqlInfoSelectModel();

        public Builder setTableName(String tableName) {
            selectModel.tableName = tableName;
            return this;
        }
        public Builder setTableName(String tableName,String alias) {
            selectModel.tableName = tableName+" "+alias;
            return this;
        }

        public Builder setColumns(String ... columns){

            selectModel.columns = columns;
            return this;
        }

        public SqlInfoSelectModel<BuildSelect> build() {
            ISQLExpression<SqlFormatModel> expression = new BuildSelect();
            selectModel.setSqlExpression(expression);
            return selectModel;
        }
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String[] getColumns() {
        return columns;
    }

    public void setColumns(String[] columns) {
        this.columns = columns;
    }
}
