package com.ruoyi.user.enums; /** * 收益来源枚举 * * 与 account_earning_record.source 字段一一对应;本期仅定义取值, * 实际写入方(订单收益 / 邀请奖励 / 等级差价)待对应业务模块接入后补齐。 * * @author hugray */ public enum EarningSourceEnum { /** 订单收益 */ ORDER("1", "订单收益"), /** 邀请奖励 */ INVITE("2", "邀请奖励"), /** 等级差价 */ LEVEL_DIFF("3", "等级差价"), /** 其他 */ OTHER("9", "其他"); /** 来源编码(落库值) */ private final String code; /** 来源描述 */ private final String desc; EarningSourceEnum(String code, String desc) { this.code = code; this.desc = desc; } public String getCode() { return code; } public String getDesc() { return desc; } /** * 按编码获取枚举 * * @param code 来源编码 * @return 命中返回枚举;未命中返回 null */ public static EarningSourceEnum getByCode(String code) { for (EarningSourceEnum source : values()) { if (source.code.equals(code)) { return source; } } return null; } }