package com.fdkankan.common.constant;

public enum CommonOperStatus {

    WAITING(0, "等待中"),
    SUCCESS(1, "成功"),
    FAILD(-1, "失败");

    private Integer code;
    private String message;

    private CommonOperStatus(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code() {
        return code;
    }

    public String message() {
        return message;
    }

    public static CommonOperStatus get(Integer code){
        CommonOperStatus[] values = CommonOperStatus.values();
        Integer enumValue = null;
        for(CommonOperStatus eachValue : values){
            enumValue = eachValue.code();
            if(enumValue.equals(code)){
                return eachValue;
            }
        }
        return null;
    }

}
