package com.qmth.sop.common.enums;

import java.util.Objects;

/**
 * 菜单类型
 *
 * @Date: 2021/3/23.
 */
public enum PrivilegeEnum {

    MENU("菜单"),

    BUTTON("按钮"),

    LINK("链接"),

    URL("接口地址"),

    LIST("列表"),

    CONDITION("查询条件");

    private String desc;

    private PrivilegeEnum(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

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