From d9859de7569271c58bfa3c17fe9ec883a1da7f99 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sat, 12 Feb 2022 13:13:04 +0800
Subject: [PATCH] 代码优化
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
index e40b0c0..a6200f0 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
@@ -41,8 +41,7 @@
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
{
- List<SysDictData> DictDatas = StringUtils.cast(cacheObj);
- return DictDatas;
+ return StringUtils.cast(cacheObj);
}
return null;
}
@@ -92,7 +91,7 @@
{
if (value.equals(dict.getDictValue()))
{
- propertyString.append(dict.getDictLabel() + separator);
+ propertyString.append(dict.getDictLabel()).append(separator);
break;
}
}
@@ -132,7 +131,7 @@
{
if (label.equals(dict.getDictLabel()))
{
- propertyString.append(dict.getDictValue() + separator);
+ propertyString.append(dict.getDictValue()).append(separator);
break;
}
}
@@ -152,6 +151,16 @@
}
/**
+ * 删除指定字典缓存
+ *
+ * @param key 字典键
+ */
+ public static void removeDictCache(String key)
+ {
+ SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
+ }
+
+ /**
* 清空字典缓存
*/
public static void clearDictCache()
--
Gitblit v1.9.2