package com.hai.order.type;

import java.util.Objects;

/**
 * 订单状态
 * @className: OrderProductType
 * @author: HuRui
 * @date: 2022/8/25
 **/
public enum OrderStatus {
    STATUS1(1, "待支付"),
    STATUS2(2, "已支付"),
    STATUS3(3, "已完成"),
    STATUS4(4, "已退款"),
    STATUS5(5, "已取消"),
    ;

    private Integer number;

    private String name;

    OrderStatus(int number, String name) {
        this.number = number;
        this.name = name;
    }

    /**
     * 根据类型查询数据
     * @param type
     * @return
     */
    public static OrderStatus getDataByType(Integer type) {
        for (OrderStatus ele : values()) {
            if(Objects.equals(type,ele.getNumber())) return ele;
        }
        return null;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
