package com.yqzx.generator.action.model;
|
|
import lombok.Getter;
|
|
/**
|
* @description: db字段类型映射
|
* @author: chaoyapeng
|
* @time: 2020/8/18 15:49
|
*/
|
@Getter
|
public enum DbColumnType {
|
|
BASE_BIGINT("bigint", "Long", "BIGINT"),
|
BASE_VARCHAR("varchar", "String", "VARCHAR"),
|
BASE_SMALLINT("smallint","Short", "SMALLINT"),
|
BASE_TINYINT("tinyint","Short", "TINYINT"),
|
BASE_TIMESTAMP("datetime", "Date", "TIMESTAMP"),
|
BASE_INTEGER("int", "Integer", "INTEGER"),
|
BASE_DOUBLE("decimal", "Double", "DECIMAL"),
|
BASE_TEXT("text", "String", "VARCHAR"),
|
BASE_LONGTEXT("longtext", "String", "VARCHAR"),
|
BASE_JSON("json", "String", "LONGVARCHAR");
|
|
private final String dataType;
|
|
private final String type;
|
|
private final String jdbcType;
|
|
DbColumnType(String dataType, String type, String jdbcType) {
|
this.dataType = dataType;
|
this.type = type;
|
this.jdbcType = jdbcType;
|
}
|
|
public static DbColumnType get(String dataType) {
|
for (DbColumnType ele : values()) {
|
if (ele.getDataType().equals(dataType)) {
|
return ele;
|
}
|
}
|
return null;
|
}
|
|
}
|