#init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.fastbee.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceStatus {
|
||||
|
||||
|
||||
online(1, "online", "在线"),
|
||||
offline(0, "offline", "离线");
|
||||
|
||||
private int type;
|
||||
private String code;
|
||||
private String description;
|
||||
|
||||
public static DeviceStatus convert(int type) {
|
||||
for (DeviceStatus value : DeviceStatus.values()) {
|
||||
if (value.type == type) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DeviceStatus convert(String code) {
|
||||
for (DeviceStatus value : DeviceStatus.values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user