Commit b15e4155 by s_guodong

获取 codeTable和codeTableLable

parent 152843b4
......@@ -32,8 +32,19 @@ public class Codetables {
static String codeTableFilePath = "codeTable";
static Map<String, List<CodetableItem>> staticCodeTableCache = new ConcurrentHashMap<>();
public static List<CodetableItem> getCodetable(String codeName) {
return null;
public static String getCodetableLabel(String key, String codetable, String language) {
String label = "";
List<CodetableItem> codeTable = getCodeTable(codetable, language);
if (!CollectionUtils.isEmpty(codeTable)) {
for (CodetableItem codetableItem : codeTable) {
if (key.equalsIgnoreCase(codetableItem.getValue())) {
label = codetableItem.getLabel();
break;
}
}
}
return label;
}
public static String getCodetableLabelOfTd(String key, String codetable, String language) {
......@@ -90,32 +101,30 @@ public class Codetables {
}
return keylst;
}
// public static IStream getTblKeyList(String table, String language) {
// return getTblKeyList(table, language);
// }
public static List<CodetableItem> getCodeTable(String codeName, String lang) {
List codetable = new ArrayList<>();
if (codeName.indexOf(":") > 0) {
String arr[] = codeName.split(":");
Map<String, Object> fieldInfo = ModuleInfoManager.getModuleFieldInfo(arr[0].trim().toLowerCase(), arr[1].trim().toLowerCase());
if (fieldInfo == null)
return codetable;
codeName = (String) fieldInfo.get("codetable");
if (MdaUtils.isEmpty(codeName))
return codetable;
} else {
//尝试从组件中加载
CodetableService codetableService = MdaEnv.getBean(CodetableService.class);
List<CodetableItem> dbCodeTable = codetableService.selectList(codeName.toUpperCase(), lang);
if (dbCodeTable != null && !dbCodeTable.isEmpty())
return dbCodeTable;
}
// if (codeName.indexOf(":") > 0) {
// String arr[] = codeName.split(":");
// Map<String, Object> fieldInfo = ModuleInfoManager.getModuleFieldInfo(arr[0].trim().toLowerCase(), arr[1].trim().toLowerCase());
// if (fieldInfo == null)
// return codetable;
// codeName = (String) fieldInfo.get("codetable");
// if (MdaUtils.isEmpty(codeName))
// return codetable;
// } else {
// //尝试从组件中加载
// CodetableService codetableService = MdaEnv.getBean(CodetableService.class);
// List<CodetableItem> dbCodeTable = codetableService.selectList(codeName.toUpperCase(), lang);
// if (dbCodeTable != null && !dbCodeTable.isEmpty())
// return dbCodeTable;
// }
String fileName = codeTableFilePath + "/";
if ("CN".equals(lang)) {
if ("zh".equals(lang)) {
fileName = fileName + codeName.toLowerCase() + "_zh_CN.ctl";
} else {
fileName = fileName + codeName.toLowerCase() + "_en_US.ctl";
......
......@@ -908,7 +908,9 @@ public class MdaUtils {
}
public static List<CodetableItem> getCodetable(String codeName) {
return null;
IContext ctx = MdaEnv.getContext();
Locale locale = ctx.getLocale();
return Codetables.getCodeTable(codeName, locale.getLanguage());
}
public static String encryptPassword(String srcPassword) {
......@@ -925,8 +927,10 @@ public class MdaUtils {
}
}
public static String getCodetableLabel(String codetable, String toString) {
return null;
public static String getCodetableLabel(String codetable, String key) {
IContext ctx = MdaEnv.getContext();
Locale locale = ctx.getLocale();
return Codetables.getCodetableLabel(key, codetable, locale.getLanguage());
}
public static String getPath(IBaseObject baseObject) {
......@@ -1608,7 +1612,8 @@ public class MdaUtils {
}
public static void setEmptyImpl(Object...obj){}
public static void setEmptyImpl(Object... obj) {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment