package com.ruoyi.common.enums;

public enum RecycleEnum {
    ONLINE(1, "线上交易平台"),
    OFFLINE(2, "线下交易场所"),
    OFFLINE_STALL(3, "线下回收门店/档口");

    private Integer code;
    private String value;

    RecycleEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    /**
     * 根据code获取去value
     *
     * @param code
     * @return
     */
    public static String getValueByCode(Integer code) {
        for (RecycleEnum recycleEnum : RecycleEnum.values()) {
            if (code.equals(recycleEnum.getCode())) {
                return recycleEnum.getValue();
            }
        }
        return null;
    }
}
