guohongjin
2024-05-15 5b7639f0bd9e056738ec15100ed0532e965c6cd5
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
62
63
64
65
66
67
68
69
package cn.stylefeng.roses.kernel.rule.enums;
 
import lombok.Getter;
 
/**
 * 系统设置-枚举
 *
 * @author goupan
 */
@Getter
public enum SystemSetEnum {
 
    USER_AGREEMENT(1, "用户协议h5"),
    PRIVACY_AGREEMENT(2, "隐私协议h5"),
    SERVICE_AGREEMENT(3, "服务协议h5"),
    ENTERPRISE_SERVICE(4, "企业服务h5"),
    OFFLINE_STORE(5, "线下门店h5"),
    COOPERATIVE_ENTERPRISE(6, "合作企业h5"),
    CUSTOMER_SERVICE_NUMBER(7, "客服电话(逗号拼接)"),
    COUNSELLING_CONTRACT(8, "咨询合同h5"),
    UNSUBSCRIBE_AGREEMENT(9, "注销协议"),
    SYSTEM_NOTICE(10, "系统公告"),
 
    START_PAGE(100, "启动页"),
    ;
 
    private final Integer code;
 
    private final String name;
 
    SystemSetEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }
 
    /**
     * 根据code获取枚举
     */
    public static SystemSetEnum codeToEnum(Integer code) {
        if (null != code) {
            for (SystemSetEnum e : SystemSetEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e;
                }
            }
        }
        return null;
    }
 
    /**
     * 编码转化成中文含义
     */
    public static String codeToName(Integer code) {
        if (null != code) {
            for (SystemSetEnum e : SystemSetEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e.getName();
                }
            }
        }
        return "未知";
    }
 
    @Override
    public String toString() {
        return "系统设置(" + code + ", " + name + ")";
    }
 
}