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 cn.stylefeng.roses.kernel.rule.enums;
|
| import lombok.Getter;
|
| /**
| * 岗位类型-枚举
| *
| * @author goupan
| */
| @Getter
| public enum PostTypeEnum {
| OTHER(0, "其他"),
| CLASS(1, "课程"),
| CONSULT(2, "咨询"),
| MENTAL_TEST(3, "性格分析"),
| CUSTOMER_SERVICE(4, "客服"),
| ;
|
| private final Integer code;
|
| private final String name;
|
| PostTypeEnum(Integer code, String name) {
| this.code = code;
| this.name = name;
| }
|
| /**
| * 根据code获取枚举
| */
| public static PostTypeEnum codeToEnum(Integer code) {
| if (null != code) {
| for (PostTypeEnum e : PostTypeEnum.values()) {
| if (e.getCode().equals(code)) {
| return e;
| }
| }
| }
| return null;
| }
|
| /**
| * 编码转化成中文含义
| */
| public static String codeToName(Integer code) {
| if (null != code) {
| for (PostTypeEnum e : PostTypeEnum.values()) {
| if (e.getCode().equals(code)) {
| return e.getName();
| }
| }
| }
| return "未知";
| }
|
| @Override
| public String toString() {
| return "岗位类型(" + code + ", " + name + ")";
| }
|
| }
|
|