|
|
@ -1,10 +1,10 @@
|
|
|
|
package com.ruoyi.common.dict.service.impl;
|
|
|
|
package com.ruoyi.common.dict.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.dev33.satoken.context.SaHolder;
|
|
|
|
import cn.dev33.satoken.context.SaHolder;
|
|
|
|
import cn.hutool.core.collection.CollStreamUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import com.ruoyi.common.core.constant.CacheConstants;
|
|
|
|
import com.ruoyi.common.core.constant.CacheConstants;
|
|
|
|
import com.ruoyi.common.core.service.DictService;
|
|
|
|
import com.ruoyi.common.core.service.DictService;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.utils.StreamUtils;
|
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
import com.ruoyi.system.api.RemoteDictService;
|
|
|
|
import com.ruoyi.system.api.RemoteDictService;
|
|
|
|
import com.ruoyi.system.api.domain.SysDictData;
|
|
|
|
import com.ruoyi.system.api.domain.SysDictData;
|
|
|
@ -45,7 +45,7 @@ public class DictServiceImpl implements DictService {
|
|
|
|
SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas);
|
|
|
|
SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = CollStreamUtil.toMap(datas, SysDictData::getDictValue, SysDictData::getDictLabel);
|
|
|
|
Map<String, String> map = StreamUtils.toMap(datas, SysDictData::getDictValue, SysDictData::getDictLabel);
|
|
|
|
if (StringUtils.containsAny(dictValue, separator)) {
|
|
|
|
if (StringUtils.containsAny(dictValue, separator)) {
|
|
|
|
return Arrays.stream(dictValue.split(separator))
|
|
|
|
return Arrays.stream(dictValue.split(separator))
|
|
|
|
.map(v -> map.getOrDefault(v, StringUtils.EMPTY))
|
|
|
|
.map(v -> map.getOrDefault(v, StringUtils.EMPTY))
|
|
|
@ -73,7 +73,7 @@ public class DictServiceImpl implements DictService {
|
|
|
|
SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas);
|
|
|
|
SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = CollStreamUtil.toMap(datas, SysDictData::getDictLabel, SysDictData::getDictValue);
|
|
|
|
Map<String, String> map = StreamUtils.toMap(datas, SysDictData::getDictLabel, SysDictData::getDictValue);
|
|
|
|
if (StringUtils.containsAny(dictLabel, separator)) {
|
|
|
|
if (StringUtils.containsAny(dictLabel, separator)) {
|
|
|
|
return Arrays.stream(dictLabel.split(separator))
|
|
|
|
return Arrays.stream(dictLabel.split(separator))
|
|
|
|
.map(l -> map.getOrDefault(l, StringUtils.EMPTY))
|
|
|
|
.map(l -> map.getOrDefault(l, StringUtils.EMPTY))
|
|
|
|