package com.seeyon.utils.form;

import java.util.List;
import java.util.Map;

public class SqlBuildParam {

    private SqlType sqlType;
    // 公共
    private String tableName;
    // SELECT / COUNT
    private List<String> queryColumns;
    private List<FormWhereCondition> conditions;
    // UPDATE
    private List<FormUpdateField> updateFields;
    // INSERT
    private Map<String, Object> insertData;
    private Integer pageNo;
    private Integer pageSize;
    private String orderField;
    private String countField;

    public SqlType getSqlType() {
        return sqlType;
    }

    public void setSqlType(SqlType sqlType) {
        this.sqlType = sqlType;
    }

    public String getTableName() {
        return tableName;
    }

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

    public List<String> getQueryColumns() {
        return queryColumns;
    }

    public void setQueryColumns(List<String> queryColumns) {
        this.queryColumns = queryColumns;
    }

    public List<FormWhereCondition> getConditions() {
        return conditions;
    }

    public void setConditions(List<FormWhereCondition> conditions) {
        this.conditions = conditions;
    }

    public List<FormUpdateField> getUpdateFields() {
        return updateFields;
    }

    public void setUpdateFields(List<FormUpdateField> updateFields) {
        this.updateFields = updateFields;
    }

    public Map<String, Object> getInsertData() {
        return insertData;
    }

    public void setInsertData(Map<String, Object> insertData) {
        this.insertData = insertData;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderField() {
        return orderField;
    }

    public void setOrderField(String orderField) {
        this.orderField = orderField;
    }
    public Integer getLimit() {
        if(this.pageSize == null) {
            return null;
        }
        return this.pageSize;
    }
    public Integer getOffset() {
        if(this.pageSize == null) {
            return null;
        }
        return (this.pageNo - 1) * this.pageSize;
    }

    public String getCountField() {
        return countField;
    }

    public void setCountField(String countField) {
        this.countField = countField;
    }
}
