duhuizhe
2024-04-19 64c4fd3c7067c7626dc960a70b4bc2c3662bc653
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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;
    }
 
}