package com.qmth.paper.library.common.enums.log;

import java.util.Objects;

/**
 * @Description: 操作类型枚举
 * @Author: CaoZixuan
 * @Date: 2022-02-14
 */
public enum OperationTypeEnum {
    UN_KNOW("未知"),
    SELECT("查询"),
    EDIT("新增或更新"),
    DELETE("删除");
    private final String desc;

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

    public String getDesc() {
        return desc;
    }

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