|
@@ -21,15 +21,23 @@ public class DictUtils {
|
|
|
* 获取字典map
|
|
|
*/
|
|
|
public static Map<String, String> getDictMap(String code) {
|
|
|
- DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
|
|
|
- dto.setDictCode(code);
|
|
|
- DynamicDataSourceContextHolder.push(BaseSourceConstant.BASE);
|
|
|
- List<DictTenantDataVo> dictTenantDataServiceList = dictTenantDataService.getList(dto);
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
+ List<DictTenantDataVo> dictTenantDataServiceList = getDictList(code);
|
|
|
Map<String, String> dictMap = new HashMap<>();
|
|
|
if (ObjectUtil.isNotEmpty(dictTenantDataServiceList)) {
|
|
|
dictMap = dictTenantDataServiceList.stream().collect(Collectors.toMap(DictTenantDataVo::getDictKey, DictTenantDataVo::getDictValue));
|
|
|
}
|
|
|
return dictMap;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取字典List
|
|
|
+ */
|
|
|
+ public static List<DictTenantDataVo> getDictList(String code) {
|
|
|
+ DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
|
|
|
+ dto.setDictCode(code);
|
|
|
+ DynamicDataSourceContextHolder.push(BaseSourceConstant.BASE);
|
|
|
+ List<DictTenantDataVo> dictTenantDataServiceList = dictTenantDataService.getList(dto);
|
|
|
+ DynamicDataSourceContextHolder.poll();
|
|
|
+ return dictTenantDataServiceList;
|
|
|
+ }
|
|
|
}
|