Pu Zhibing
4 天以前 3244b550596e0330031b3f4547356927df83b0ad
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 WarrantyStateEnum {
 
    /*保单状态 1正常 2已脱保 3已停保 4即将到期 5建议停保*/
 
    NORMAL(1, "正常"),
    DELISTED(2, "已脱保"),
    DISCONTINUED_WARRANTY(3, "已停保"),
    DUE(4, "即将到期"),
    SUGGEST_DISCONTINUING_MAINTENANCE(5, "建议停保");
 
    @Getter
    private String desc;
 
 
    @Getter
    private int code;
 
 
    WarrantyStateEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static WarrantyStateEnum fromCode(Integer code) {
        WarrantyStateEnum[] resultTypes = WarrantyStateEnum.values();
        for (WarrantyStateEnum resultType : resultTypes) {
            if (code.equals(resultType.getCode())) {
                return resultType;
            }
        }
        return null;
    }
 
}