Commit b86b48ec by 向延琳

提交枚举类

1 parent f8381112
......@@ -2,6 +2,11 @@ package cn.com.glsx.devicemonitor.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import javax.annotation.Nullable;
import java.util.Objects;
import java.util.Optional;
/**
* 1:上午(6:00~12:00)2:下午(12:00~21:00)3:夜晚(21:00~6:00)4:全天 当当前是基站查询时该字段为0
......@@ -45,4 +50,16 @@ public enum ResidentTimesEnum {
* 描述
*/
private final String description;
public static ResidentTimesEnum getByCode(@Nullable Integer code) {
if (Objects.isNull(code)) {
return null;
}
for (ResidentTimesEnum value : ResidentTimesEnum.values()) {
if (Objects.equals(value.getCode(), code)) {
return value;
}
}
return null;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!