package com.zy.core.enums; public enum JarStatusType { IDLE(0, "空闲"), MOVING(1, "作业中"), SOS(2, "报警"), WAITING(10, "等待确认"), OFF_LINE(-1, "未知"), OTHER(100, "其它"), ; public Integer id; public String desc; JarStatusType(Integer id, String desc) { this.id = id; this.desc = desc; } public static JarStatusType get(Short id) { if (null == id) { return null; } for (JarStatusType type : JarStatusType.values()) { if (type.id.equals(id.intValue())) { return type; } } return OFF_LINE; } public static JarStatusType get(JarStatusType type) { if (null == type) { return null; } for (JarStatusType jarStatusType : JarStatusType.values()) { if (jarStatusType == type) { return jarStatusType; } } return null; } }