|
|
@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
@ -38,10 +39,10 @@ public class DictUtils
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static List<SysDictData> getDictCache(String key)
|
|
|
|
public static List<SysDictData> getDictCache(String key)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
|
|
|
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
|
|
|
if (StringUtils.isNotNull(cacheObj))
|
|
|
|
if (StringUtils.isNotNull(arrayCache))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return StringUtils.cast(cacheObj);
|
|
|
|
return arrayCache.toList(SysDictData.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -83,27 +84,30 @@ public class DictUtils
|
|
|
|
StringBuilder propertyString = new StringBuilder();
|
|
|
|
StringBuilder propertyString = new StringBuilder();
|
|
|
|
List<SysDictData> datas = getDictCache(dictType);
|
|
|
|
List<SysDictData> datas = getDictCache(dictType);
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas))
|
|
|
|
if (StringUtils.isNotNull(datas))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (SysDictData dict : datas)
|
|
|
|
if (StringUtils.containsAny(separator, dictValue))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (String value : dictValue.split(separator))
|
|
|
|
for (SysDictData dict : datas)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value.equals(dict.getDictValue()))
|
|
|
|
for (String value : dictValue.split(separator))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
propertyString.append(dict.getDictLabel()).append(separator);
|
|
|
|
if (value.equals(dict.getDictValue()))
|
|
|
|
break;
|
|
|
|
{
|
|
|
|
|
|
|
|
propertyString.append(dict.getDictLabel()).append(separator);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (SysDictData dict : datas)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (dictValue.equals(dict.getDictValue()))
|
|
|
|
for (SysDictData dict : datas)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return dict.getDictLabel();
|
|
|
|
if (dictValue.equals(dict.getDictValue()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return dict.getDictLabel();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|