luodangjia
2024-12-10 ee7ce5d1cbf80bee0a15c1e5bc5eaa30858d812b
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
package com.hollywood.common.enums;
 
import lombok.Getter;
 
/**
 * @Description
 * @Author xiaochen
 * @Date 2022/6/10/010 16:42
 */
public enum TargetStateEnum {
 
    WAIT_AUDIT(1, "待审核"),
    UNFINISHED(2, "未完成"),
    FINISHED(3, "已完成"),
    REJECTED(4, "已驳回");
 
    @Getter
    private String desc;
 
 
    @Getter
    private int code;
 
 
    TargetStateEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static TargetStateEnum fromCode(Integer code) {
        TargetStateEnum[] resultTypes = TargetStateEnum.values();
        for (TargetStateEnum resultType : resultTypes) {
            if (code.equals(resultType.getCode())) {
                return resultType;
            }
        }
        return null;
    }
 
}