package com.zy.core.enums; public enum SteStatusType { IDLE(0, "空闲"), MOVING(1, "作业中"), SOS(2, "报警"), OFF_LINE(-1, "未知"), ; public Integer id; public String desc; SteStatusType(Integer id, String desc) { this.id = id; this.desc = desc; } public static SteStatusType get(Short id) { if (null == id) { return null; } for (SteStatusType type : SteStatusType.values()) { if (type.id.equals(id.intValue())) { return type; } } return OFF_LINE; } public static SteStatusType get(SteStatusType type) { if (null == type) { return null; } for (SteStatusType crnStatusType : SteStatusType.values()) { if (crnStatusType == type) { return crnStatusType; } } return null; } }