puzhibing
2023-05-22 e55987208ea639e33006e78146a47266a4b2ed6d
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
package com.stylefeng.guns.modular.system.enums;
 
 
 
/**
 * @Description 事由管理类型枚举
 * @Author xiaochen
 * @Date 2023/02/15 9:42
 */
public enum MainContentTypeEnum {
 
 
    TRANSFER_ORDER(1, "转单"),
    DRIVER_CANCEL_ORDER(2, "司机消单"),
    USER_CANCEL_ORDER(3, "用户取消订单");
 
    private String desc;
 
 
    private int code;
 
 
    MainContentTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    public String getDesc() {
        return desc;
    }
 
    public int getCode() {
        return code;
    }
 
    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static MainContentTypeEnum fromCode(Integer code) {
        MainContentTypeEnum[] resultTypes = MainContentTypeEnum.values();
        for (MainContentTypeEnum resultType : resultTypes) {
            if (code.equals(resultType.getCode())) {
                return resultType;
            }
        }
        return null;
    }
 
}