package com.zfire.jiasm.syncdata.constant;

import lombok.Getter;

/**
 * 功能描述:
 * 数据库描述
 */
@Getter
public enum DatabaseEnum {
    // 家盛茂
    JIASM(1,"jiasm"),

    // 工单系统数据库
    GEJIANG(2,"gejiang"),

    ;

    /**
     * 编码
     */
    private final int code;

    /**
     * 介绍
     */
    private final String text;

    DatabaseEnum(int code, String text) {
        this.code = code;
        this.text = text;
    }

    /**
     * 通过code获取枚举
     * @param code 编码
     * @return DatabaseEnum
     */
    public static DatabaseEnum getEnumByCode(int code) {
        DatabaseEnum result = null;
        for (DatabaseEnum item : values()) {
            if (code==item.getCode()) {
                result = item;
                break;
            }
        }
        return result;
    }
}
