package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum OperateStatus { WAREHOUSEIN(10, "仓库入库"), WAREHOUSEOUT(11, "仓库领用"), LABORATORYIN(0, "试剂柜入库"), TRANSFER(6,"转移"), SCRAP(5, "报废"); private int key; private String text; private OperateStatus(int key, String text) { this.key = key; this.text = text; } public int getKey() { return key; } public String getText() { return text; } private static HashMap map = new HashMap(); static { for(OperateStatus d : OperateStatus.values()){ map.put(d.key, d); } } public static OperateStatus parse(Integer index) { if(map.containsKey(index)){ return map.get(index); } return null; } }