package com.yuanchu.mom.enums; import org.apache.commons.lang3.StringUtils; public enum QrModelType { WORD_TYPE("word","word_qr_show"), DEVICE_TYPE("device","device_qr_show"); String type,value; QrModelType(String desc, String value) { this.type = desc; this.value = value; } public String getType() { return type; } public String getValue() { return value; } /** * 根据类型获取枚举值 * @param type * @return */ public static String getValueByType(String type){ for (QrModelType qrModelType : QrModelType.values()) { if(StringUtils.isNotBlank(type) && type.equals(qrModelType.getType())){ return qrModelType.getValue(); } } throw new IllegalArgumentException(); } }