liujie
23 小时以前 384bce80449b17651937429038c4370dbce60e7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
    }
}