package com.iailab.module.data.enums;
|
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
import java.util.Calendar;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年11月08日
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum TimeGranularityEnum {
|
|
TG_MIN("min", Calendar.MINUTE),
|
TG_HOUR("hour", Calendar.HOUR_OF_DAY),
|
TG_DAY("day", Calendar.DAY_OF_YEAR),
|
TG_MON("mon",Calendar.MONTH);
|
|
private String code;
|
|
private Integer value;
|
|
public static TimeGranularityEnum getEumByCode(String code) {
|
if (code == null) {
|
return null;
|
}
|
|
for (TimeGranularityEnum statusEnum : TimeGranularityEnum.values()) {
|
if (statusEnum.getCode().equals(code)) {
|
return statusEnum;
|
}
|
}
|
return null;
|
}
|
}
|