package com.zy.core.enums.DevpType; public enum DevpStateType { NONE(-1,"离线"), STOP(0,"停机"), HAND(1,"手动"), AUTO(2,"自动"), FAULT(3,"故障"); public Integer id; public String desc; DevpStateType(Integer id, String desc) { this.id = id; this.desc = desc; } public static DevpStateType get(Short id) { if (null == id) { return null; } for (DevpStateType type : DevpStateType.values()) { if (type.id.equals(id.intValue())) { return type; } } return NONE; } public static DevpStateType get(DevpStateType type) { if (null == type) { return null; } for (DevpStateType devpModeType : DevpStateType.values()) { if (devpModeType == type) { return devpModeType; } } return null; } }