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