Commit b15e4155 by s_guodong

获取 codeTable和codeTableLable

parent 152843b4
...@@ -32,8 +32,19 @@ public class Codetables { ...@@ -32,8 +32,19 @@ public class Codetables {
static String codeTableFilePath = "codeTable"; static String codeTableFilePath = "codeTable";
static Map<String, List<CodetableItem>> staticCodeTableCache = new ConcurrentHashMap<>(); 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) { public static String getCodetableLabelOfTd(String key, String codetable, String language) {
...@@ -90,32 +101,30 @@ public class Codetables { ...@@ -90,32 +101,30 @@ public class Codetables {
} }
return keylst; return keylst;
} }
// public static IStream getTblKeyList(String table, String language) {
// return getTblKeyList(table, language);
// }
public static List<CodetableItem> getCodeTable(String codeName, String lang) { public static List<CodetableItem> getCodeTable(String codeName, String lang) {
List codetable = new ArrayList<>(); List codetable = new ArrayList<>();
if (codeName.indexOf(":") > 0) { // if (codeName.indexOf(":") > 0) {
String arr[] = codeName.split(":"); // String arr[] = codeName.split(":");
Map<String, Object> fieldInfo = ModuleInfoManager.getModuleFieldInfo(arr[0].trim().toLowerCase(), arr[1].trim().toLowerCase()); // Map<String, Object> fieldInfo = ModuleInfoManager.getModuleFieldInfo(arr[0].trim().toLowerCase(), arr[1].trim().toLowerCase());
if (fieldInfo == null) // if (fieldInfo == null)
return codetable; // return codetable;
codeName = (String) fieldInfo.get("codetable"); // codeName = (String) fieldInfo.get("codetable");
if (MdaUtils.isEmpty(codeName)) // if (MdaUtils.isEmpty(codeName))
return codetable; // return codetable;
} else { // } else {
//尝试从组件中加载 // //尝试从组件中加载
CodetableService codetableService = MdaEnv.getBean(CodetableService.class); // CodetableService codetableService = MdaEnv.getBean(CodetableService.class);
List<CodetableItem> dbCodeTable = codetableService.selectList(codeName.toUpperCase(), lang); // List<CodetableItem> dbCodeTable = codetableService.selectList(codeName.toUpperCase(), lang);
if (dbCodeTable != null && !dbCodeTable.isEmpty()) // if (dbCodeTable != null && !dbCodeTable.isEmpty())
return dbCodeTable; // return dbCodeTable;
} // }
String fileName = codeTableFilePath + "/"; String fileName = codeTableFilePath + "/";
if ("CN".equals(lang)) { if ("zh".equals(lang)) {
fileName = fileName + codeName.toLowerCase() + "_zh_CN.ctl"; fileName = fileName + codeName.toLowerCase() + "_zh_CN.ctl";
} else { } else {
fileName = fileName + codeName.toLowerCase() + "_en_US.ctl"; fileName = fileName + codeName.toLowerCase() + "_en_US.ctl";
......
...@@ -908,7 +908,9 @@ public class MdaUtils { ...@@ -908,7 +908,9 @@ public class MdaUtils {
} }
public static List<CodetableItem> getCodetable(String codeName) { 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) { public static String encryptPassword(String srcPassword) {
...@@ -925,8 +927,10 @@ public class MdaUtils { ...@@ -925,8 +927,10 @@ public class MdaUtils {
} }
} }
public static String getCodetableLabel(String codetable, String toString) { public static String getCodetableLabel(String codetable, String key) {
return null; IContext ctx = MdaEnv.getContext();
Locale locale = ctx.getLocale();
return Codetables.getCodetableLabel(key, codetable, locale.getLanguage());
} }
public static String getPath(IBaseObject baseObject) { public static String getPath(IBaseObject baseObject) {
...@@ -1608,7 +1612,8 @@ public class MdaUtils { ...@@ -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