|
|
@@ -89,8 +89,11 @@ public class DictUtils
|
|
|
{
|
|
|
StringBuilder propertyString = new StringBuilder();
|
|
|
List<SysDictData> datas = getDictCache(dictType);
|
|
|
-
|
|
|
- if (StringUtils.containsAny(dictValue, separator) && StringUtils.isNotEmpty(datas))
|
|
|
+ if (StringUtils.isNull(datas))
|
|
|
+ {
|
|
|
+ return StringUtils.EMPTY;
|
|
|
+ }
|
|
|
+ if (StringUtils.containsAny(dictValue, separator))
|
|
|
{
|
|
|
for (SysDictData dict : datas)
|
|
|
{
|
|
|
@@ -129,8 +132,11 @@ public class DictUtils
|
|
|
{
|
|
|
StringBuilder propertyString = new StringBuilder();
|
|
|
List<SysDictData> datas = getDictCache(dictType);
|
|
|
-
|
|
|
- if (StringUtils.containsAny(dictLabel, separator) && StringUtils.isNotEmpty(datas))
|
|
|
+ if (StringUtils.isNull(datas))
|
|
|
+ {
|
|
|
+ return StringUtils.EMPTY;
|
|
|
+ }
|
|
|
+ if (StringUtils.containsAny(dictLabel, separator))
|
|
|
{
|
|
|
for (SysDictData dict : datas)
|
|
|
{
|
|
|
@@ -158,6 +164,48 @@ public class DictUtils
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 根据字典类型获取字典所有值
|
|
|
+ *
|
|
|
+ * @param dictType 字典类型
|
|
|
+ * @return 字典值
|
|
|
+ */
|
|
|
+ public static String getDictValues(String dictType)
|
|
|
+ {
|
|
|
+ StringBuilder propertyString = new StringBuilder();
|
|
|
+ List<SysDictData> datas = getDictCache(dictType);
|
|
|
+ if (StringUtils.isNull(datas))
|
|
|
+ {
|
|
|
+ return StringUtils.EMPTY;
|
|
|
+ }
|
|
|
+ for (SysDictData dict : datas)
|
|
|
+ {
|
|
|
+ propertyString.append(dict.getDictValue()).append(SEPARATOR);
|
|
|
+ }
|
|
|
+ return StringUtils.stripEnd(propertyString.toString(), SEPARATOR);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据字典类型获取字典所有标签
|
|
|
+ *
|
|
|
+ * @param dictType 字典类型
|
|
|
+ * @return 字典值
|
|
|
+ */
|
|
|
+ public static String getDictLabels(String dictType)
|
|
|
+ {
|
|
|
+ StringBuilder propertyString = new StringBuilder();
|
|
|
+ List<SysDictData> datas = getDictCache(dictType);
|
|
|
+ if (StringUtils.isNull(datas))
|
|
|
+ {
|
|
|
+ return StringUtils.EMPTY;
|
|
|
+ }
|
|
|
+ for (SysDictData dict : datas)
|
|
|
+ {
|
|
|
+ propertyString.append(dict.getDictLabel()).append(SEPARATOR);
|
|
|
+ }
|
|
|
+ return StringUtils.stripEnd(propertyString.toString(), SEPARATOR);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 删除指定字典缓存
|
|
|
*
|
|
|
* @param key 字典键
|