yangys
2024-09-04 04c57331cf84c8f606c2838dcb6fe5463fb9b68c
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
package com.qianwen.smartman.modules.tool.enums;
 
public enum ToolLifeCountMethodEnum {
    NUMBER(1, "按计数"),
    TIME(2, "按时间");
    
    private final Integer code;
    private final String desc;
 
    ToolLifeCountMethodEnum(final Integer code, final String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    public Integer getCode() {
        return this.code;
    }
 
    public String getDesc() {
        return this.desc;
    }
 
    public static ToolLifeCountMethodEnum findByDesc(String desc) {
        ToolLifeCountMethodEnum[] values = values();
        for (ToolLifeCountMethodEnum value : values) {
            if (value.desc.equals(desc)) {
                return value;
            }
        }
        return null;
    }
 
    public static ToolLifeCountMethodEnum findByCode(Integer desc) {
        ToolLifeCountMethodEnum[] values = values();
        for (ToolLifeCountMethodEnum value : values) {
            if (value.code.equals(desc)) {
                return value;
            }
        }
        return null;
    }
}