package com.hfkj.sysenum;

import java.util.Objects;

/**
 * 交易订单创建类型
 * @className: TradeOrderCreateType
 * @author: HuRui
 * @date: 2023/5/24
 **/
public enum TradeOrderCreateTypeEnum {
    type1(1, "扫一扫"),
    type2(2, "被扫"),
    type3(3, "API");

    private Integer code;

    private String name;

    TradeOrderCreateTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static TradeOrderCreateTypeEnum getNameByCode(Integer code) {
        for (TradeOrderCreateTypeEnum ele : values()) {
            if (Objects.equals(code,ele.getCode())) {
                return ele;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

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