2026-04-17 17:12:41 +08:00
|
|
|
package com.maibu.enums;
|
2026-04-17 10:42:16 +08:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|