package com.zy.core.enums.DevpType; public enum DevpLocType { NONE(0,"离线"), LOW(1,"低库位"), MIDDLE(2,"中库位"), HIGH(3,"高库位"); public Integer id; public String desc; DevpLocType(Integer id, String desc) { this.id = id; this.desc = desc; } public static DevpLocType get(Short id) { if (null == id) { return null; } for (DevpLocType type : DevpLocType.values()) { if (type.id.equals(id.intValue())) { return type; } } return NONE; } public static DevpLocType get(DevpLocType type) { if (null == type) { return null; } for (DevpLocType devpLocType : DevpLocType.values()) { if (devpLocType == type) { return devpLocType; } } return null; } }