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