Sfoglia il codice sorgente

字典翻译方法扩展以及调用样例

WXF 2 anni fa
parent
commit
4ae7d2c21f

+ 3 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/demo/service/TestService.java

@@ -25,10 +25,11 @@ public class TestService {
 
     public PageInfo<TestVO> getTestPageList(TestPageParam params) {
         PageUtil.setPageInfo(params);
-        params.setCreateUserId(AuthUtil.getCurrentUserId());
+        //params.setCreateUserId(AuthUtil.getCurrentUserId());
         List<TestVO> list = testMapper.getTestPageList(params);
         //字典翻译
-        Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(DictConstants.LEVEL + "," + DictConstants.DRIVE_TYPE);
+        //Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(DictConstants.LEVEL + "," + DictConstants.DRIVE_TYPE);
+        Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(DictConstants.LEVEL,DictConstants.DRIVE_TYPE);
         list.forEach(testVO ->{
             testVO.setLevel_name(dictMapsByTypes.get(DictConstants.LEVEL).get(testVO.getLevel()));
         });

+ 14 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/DictService.java

@@ -134,6 +134,20 @@ public class DictService {
         return getDictMapsByTypes(dictParam);
     }
 
+    public Map<String, Map<String,String>> getDictMapsByTypes(String param,String ...arg) {
+        StringBuffer sb = new StringBuffer(param);
+        if(arg != null){
+            for (String s: arg) {
+                if(s != null && s != ""){
+                    sb.append(",").append(s);
+                }
+            }
+        }
+        DictParam dictParam = new DictParam();
+        dictParam.setDictTypes(sb.toString());
+        return getDictMapsByTypes(dictParam);
+    }
+
     public Map<String,String> getDictMapByType(String param) {
         DictParam dictParam = new DictParam();
         dictParam.setDictTypes(param);