提交 | 用户 | 时间
|
808189
|
1 |
package com.iailab.module.data.enums; |
潘 |
2 |
|
|
3 |
import lombok.AllArgsConstructor; |
|
4 |
import lombok.Getter; |
|
5 |
|
|
6 |
/** |
|
7 |
* @author PanZhibao |
|
8 |
* @Description |
|
9 |
* @createTime 2024年11月18日 |
|
10 |
*/ |
|
11 |
@Getter |
|
12 |
@AllArgsConstructor |
|
13 |
public enum TimeGranularitySecEnum { |
|
14 |
TG_MIN("min", 60), |
|
15 |
TG_HOUR("hour", 60 * 60), |
|
16 |
TG_DAY("day", 60 * 60 * 24); |
|
17 |
|
|
18 |
private String code; |
|
19 |
|
|
20 |
private Integer value; |
|
21 |
|
|
22 |
public static TimeGranularitySecEnum getEumByCode(String code) { |
|
23 |
if (code == null) { |
|
24 |
return null; |
|
25 |
} |
|
26 |
|
|
27 |
for (TimeGranularitySecEnum statusEnum : TimeGranularitySecEnum.values()) { |
|
28 |
if (statusEnum.getCode().equals(code)) { |
|
29 |
return statusEnum; |
|
30 |
} |
|
31 |
} |
|
32 |
return null; |
|
33 |
} |
|
34 |
} |