package org.springblade.flow.visual.onlinedev.common.relation;

import java.io.Serializable;

/**
 * 前端传递的表单选择的字段和表信息
 * 
 * @author william
 * @date 2022年8月24日 下午5:46:13
 */
public class RelationField implements Serializable {

	private static final long serialVersionUID = 1L;

	private int index;
	private int fieldId;
	/**
	 * 字段名
	 */
	private String field;
	/**
	 * 中文名
	 */
	private String fieldName;
	private String dataType;

	private String tableAliasName;
	private String tableName;

	public RelationField() {
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public int getFieldId() {
		return fieldId;
	}

	public void setFieldId(int fieldId) {
		this.fieldId = fieldId;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getDataType() {
		if (dataType.toLowerCase().equalsIgnoreCase("string")) {
			return "varchar";
		} else if (dataType.toLowerCase().equalsIgnoreCase("number")) {
			return "decimal";
		}
		return dataType.toLowerCase();
	}

	public String getDataTypeOrigin() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public String getTableAliasName() {
		return tableAliasName;
	}

	public void setTableAliasName(String tableAliasName) {
		this.tableAliasName = tableAliasName;
	}

	public String getTableName() {
		return tableName;
	}

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

	@Override
	public String toString() {
		return "RelationField [index=" + index + ", fieldId=" + fieldId + ", field=" + field + ", fieldName="
				+ fieldName + ", dataType=" + dataType + ", tableAliasName=" + tableAliasName + ", tableName="
				+ tableName + "]";
	}
	
}
