package com.hai.order.type;

import java.util.Objects;

/**
 * 订单支付方式
 * @className: OrderPayType
 * @author: HuRui
 * @date: 2022/8/25
 **/
public enum OrderPayType {
    PAY_TYPE1(1, "支付宝"),
    PAY_TYPE2(2, "微信"),
    @Deprecated
    PAY_TYPE3(3, "金币"),
    PAY_TYPE4(4, "贵州汇联通工会卡"),
    PAY_TYPE5(5, "银联"),
    PAY_TYPE6(6, "银联分期"),
    PAY_TYPE7(7, "嗨森逛油卡"),
            ;

    private Integer number;

    private String name;

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

    /**
     * 根据类型查询数据
     * @param type
     * @return
     */
    public static OrderPayType getDataByType(Integer type) {
        for (OrderPayType 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;
    }
}
