package com.hfkj.sysenum.gas;

import java.util.Objects;

/**
 * @className: OrderOilStatus
 * @author: HuRui
 * @date: 2023/6/7
 **/
public enum OrderOilStatus {
    STATUS1(1, "待支付"),
    STATUS2(2, "已支付"),
    STATUS3(3, "已取消"),
    STATUS4(4, "已退款"),
    STATUS5(5, "退款中"),
    STATUS6(6, "退款失败"),
    ;

    private Integer number;

    private String name;

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

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

    public static String getNameByType(Integer type) {
        for (OrderOilStatus ele : values()) {
            if(Objects.equals(type,ele.getNumber())) return ele.getName();
        }
        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;
    }
}
