package org.springblade.sqlfly.type;

/**
 * mysql数据类型映射到Java
 * 
 * @author William
 * @date 2022年10月28日 上午11:31:13
 */
public class MysqlType extends JavaType {

	public MysqlType() {
	}

	@Override
	public String get(String dataType) {
		String type = dataType.toLowerCase();
		if (type.contains("int")) {
			if (type.contains("bigint")) {
				return "Long";
			}
			return "Integer";
		}

		if (type.contains("number")) {
			return "Integer";
		}

		if (type.contains("float")) {
			return "Float";
		}

		if (type.contains("double")) {
			return "Double";
		}

		if (type.contains("bit") || type.contains("bool")) {
			return "Boolean";
		}

		if (type.contains("decimal")) {
			return "BigDecimal";
		}

		if (type.contains("time") || type.contains("date")) {
			return "Date";
		}

		return "String";
	}

	@Override
	public String get(String dataType, int size, int scale) {
		return null;
	}

}
