package com.goafanti.order.enums; import java.util.HashMap; import java.util.Map; public enum refundState { /** 正常 **/ DSH(0,"待审核"), /** 废除 **/ SHTG(1,"审核通过"), /** 锁定 **/ SHJJ(2,"审核拒绝"), /** 无效 **/ INVALID(10, "INVALID"); private refundState(Integer code, String desc) { this.code = code; this.desc = desc; } private static Map status = new HashMap(); static { for (refundState value : refundState.values()) { status.put(value.getCode(), value); } } public static refundState getStatus(Integer code) { if (containsType(code)) { return status.get(code); } return INVALID; } public static boolean containsType(Integer code) { return status.containsKey(code); } private Integer code; private String desc; public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } }