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
| package com.hollywood.common.enums;
|
| import lombok.Getter;
|
| /**
| * @Description
| * @Author xiaochen
| * @Date 2022/6/10/010 16:42
| */
| public enum UserTypeEnum {
|
| /*用户岗位类型 1区总 2KAM 3DR 4督导 5HC 6负责人*/
| TOTAL_AREA(1, "区总"),
| SUPERVISOR(4, "督导"),
| KAM(2, "KAM"),
| DR(3, "DR"),
| HC(5, "HC"),
| PRINCIPAL(6, "负责人");
|
| @Getter
| private String desc;
|
|
| @Getter
| private int code;
|
|
| UserTypeEnum(int code, String desc) {
| this.code = code;
| this.desc = desc;
| }
|
| /**
| * 通过code获取枚举
| *
| * @param code
| * @return
| */
| public static UserTypeEnum fromCode(Integer code) {
| UserTypeEnum[] resultTypes = UserTypeEnum.values();
| for (UserTypeEnum resultType : resultTypes) {
| if (code.equals(resultType.getCode())) {
| return resultType;
| }
| }
| return null;
| }
|
| }
|
|