DictUtils工具类
public class DictUtils {
public static List<Commpara> dictList = new ArrayList<>();
private static Map<String,String> dictResult = new HashMap();
public static String getDictTypeName(String dictTypeCode, String dictValue){
if(dictValue == null || "".equals(dictValue)){
return null;
}
if(dictResult.get(dictTypeCode + "_" + dictValue) != null){
return dictResult.get(dictTypeCode + "_" + dictValue);
}
for(Commpara commpara : dictList){
if(commpara.getParaCode().equals(dictTypeCode) && commpara.getParaKey().equals(dictValue)){
dictResult.put(commpara.getParaCode() + "_" + commpara.getParaKey(),commpara.getParaName());
return commpara.getParaName();
}
}
return "";
}
}
字典管理
public class Commpara implements Serializable {
private static final long serialVersionUID = 1L;
//主键
private Integer paraId;
//参数编码
private String paraCode;
//参数名称
private String paraName;
//参数值
private String paraKey;
//排序
private String sortNo;
//状态
private String state;
getter and setter ...
}
}