package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 是否必填注解
 * @author: zhanghang
 * @time: 2022/3/11 16:03
 */
public enum ColumnTypeEnum {
    FIELD_ORDINARY("1", "普通字段"),
    FIELD_NUMBER("2", "编号字段");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

    ColumnTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static ColumnTypeEnum getEnum(String key) {
        for (ColumnTypeEnum item : ColumnTypeEnum.values()) {
            if (item.key.equals(key)) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String key) {
        ColumnTypeEnum item = getEnum(key);
        return item != null ? item.name : null;
    }
}
