| 1234567891011121314151617181920212223242526272829303132333435363738 |
- package cn.com.lzt.common.util;
- import java.util.List;
- import org.apache.commons.lang.xwork.StringUtils;
- import org.jeecgframework.core.util.ApplicationContextUtil;
- import org.jeecgframework.core.util.MutiLangUtil;
- import org.jeecgframework.web.system.pojo.base.TSType;
- import org.jeecgframework.web.system.service.SystemService;
- /**
- * 字典code-name转换工具类
- * */
- public class DictUtil {
-
- public static String formatToTypeName(String value,String typeGroupCode) {
- String[] values = value.split(",");
- String names = "";
- List<TSType> types = ApplicationContextUtil.getContext().getBean(SystemService.class).getTypesByGroupcodeFromCache(typeGroupCode.toLowerCase());//ResourceUtil.allTypes.get(typeGroupCode.toLowerCase());
- if(types != null) {
- String name = "";
- for(String valueN:values) {
- for(TSType type: types) {
- if(type.getTypecode().equals(valueN)) {
- name = type.getTypename();
- name = MutiLangUtil.doMutiLang(name,null);
- names += name+",";
- break;
- }
- }
- }
- }
- if(StringUtils.isNotBlank(names)) {
- return names.substring(0, names.length() - 1);
- }
- return names;
- }
- }
|