package com.qmth.jkserver.enums;

import java.util.Objects;

/**
 * @Description: 检录状态
 * @Author: CaoZixuan
 * @Date: 2021-11-11
 */
public enum RegistrationStatusEnum {
    NO_REGISTER("未检录",null),
    PASS("通过", true),
    NO_PASS("不通过", false),
    ;

    RegistrationStatusEnum(String desc, Boolean dbValue) {
        this.desc = desc;
        this.dbValue = dbValue;
    }

    private final String desc;
    private final Boolean dbValue;

    public String getDesc() {
        return desc;
    }

    public Boolean getDbValue() {
        return dbValue;
    }

    /**
     * 根据枚举类的id查找枚举的名字
     * @param dbValue dbValue
     * @return 结果
     */
    public static String convertIdToName(Boolean dbValue){
        String result = null;
        for (RegistrationStatusEnum value : RegistrationStatusEnum.values()) {
            if (Objects.equals(value.dbValue,dbValue)){
                result = value.desc;
            }
        }
        return result;
    }
}
