package com.qmth.paper.library.business.enums;

import java.util.Objects;

/**
 * @Description: 字典管理枚举
 * @Author: CaoZixuan
 * @Date: 2021-11-02
 */
public enum DictionaryEnum {
    COLLEGE("学院"),
    MAJOR("专业"),
    CLAZZ("班级");
    private final String desc;

    DictionaryEnum(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 状态转换 toName
     *
     * @param title
     * @return
     */
    public static String convertToName(String title) {
        for (DictionaryEnum e : DictionaryEnum.values()) {
            if (Objects.equals(title, e.getDesc())) {
                return e.name();
            }
        }
        return null;
    }
}
