package com.cool.store.enums;

/**
 * @author su'zh
 * 审批操作类型枚举
 */
public enum AuditOperationTypeEnum {
    /**
     * 申请操作
     */
    APPLY(1, "申请"),

    /**
     * 审批通过
     */
    APPROVE(2, "审批成功"),

    /**
     * 审批拒绝
     */
    REJECT(3, "审批失败");

    private final Integer code;
    private final String desc;

    AuditOperationTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code获取枚举
     */
    public static AuditOperationTypeEnum getByCode(Integer code) {
        for (AuditOperationTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
