mitao
2024-05-16 4965b67d9e2a8e99894bd40aff7c88d695ec4040
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.ruoyi.common.core.enums;
 
import lombok.Getter;
 
/**
 * @Description
 * @Author xiaochen
 * @Date 2023/6/8 16:42
 */
public enum HandoverStateEnum {
 
    /*交车状态 1待交车 2待审批 3已交车 4审批拒绝*/
 
    VEHICLE_DELIVERED(1, "待交车"),
    PENDING_APPROVAL(2, "待审批"),
    DELIVERED(3, "已交车"),
    APPROVAL_REJECTION(4, "审批拒绝"),
    REVOKED(5, "已撤销");
 
    @Getter
    private String desc;
 
 
    @Getter
    private int code;
 
 
    HandoverStateEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static HandoverStateEnum fromCode(Integer code) {
        HandoverStateEnum[] resultTypes = HandoverStateEnum.values();
        for (HandoverStateEnum resultType : resultTypes) {
            if (code.equals(resultType.getCode())) {
                return resultType;
            }
        }
        return null;
    }
 
}