package com.jxy.order.enums;

/**
 * 订单状态
 */
public enum OrderStatus {
    /**
     * 2支付待确认
     * 1支付成功
     * 0支付失败
     */

    PAY_OFF(2, "支付待确认"),
    SUCCESS(1, "支付成功"),
    PAY_FAIL(0, "支付失败");

    private final int code;
    private final String status;

    OrderStatus(int code, String status)
    {
        this.code = code;
        this.status = status;
    }

    public int getCode() {
        return code;
    }

    public String getStatus() {
        return status;
    }

    public static String getStatusByCode(int code){
        for (OrderStatus u : OrderStatus.values()) {
            if(u.getCode()==code){
                return u.getStatus();
            }
        }
        return "";
    }
}
