package com.ruoyi.database.enums;


import lombok.Getter;

@Getter
public enum PayType {
    WECHAT("wechat", "微信支付"),
    ALIPAY("alipay", "支付宝支付");

    private final String code;
    private final String description;

    PayType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    public static PayType getByCode(String code) {
        for (PayType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("不支持的支付方式: " + code);
    }
}
