|
@@ -91,9 +91,10 @@ public class DictUtils |
|
@@ -91,9 +91,10 @@ public class DictUtils |
|
91
|
{
|
91
|
{
|
|
92
|
StringBuilder propertyString = new StringBuilder();
|
92
|
StringBuilder propertyString = new StringBuilder();
|
|
93
|
List<SysDictData> datas = getDictCache(dictType);
|
93
|
List<SysDictData> datas = getDictCache(dictType);
|
|
94
|
-
|
|
|
|
95
|
- if (StringUtils.isNotNull(datas))
|
94
|
+ if (StringUtils.isNull(datas))
|
|
96
|
{
|
95
|
{
|
|
|
|
96
|
+ return StringUtils.EMPTY;
|
|
|
|
97
|
+ }
|
|
97
|
if (StringUtils.containsAny(separator, dictValue))
|
98
|
if (StringUtils.containsAny(separator, dictValue))
|
|
98
|
{
|
99
|
{
|
|
99
|
for (SysDictData dict : datas)
|
100
|
for (SysDictData dict : datas)
|
|
@@ -118,7 +119,6 @@ public class DictUtils |
|
@@ -118,7 +119,6 @@ public class DictUtils |
|
118
|
}
|
119
|
}
|
|
119
|
}
|
120
|
}
|
|
120
|
}
|
121
|
}
|
|
121
|
- }
|
|
|
|
122
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
122
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
|
123
|
}
|
123
|
}
|
|
124
|
|
124
|
|
|
@@ -134,8 +134,11 @@ public class DictUtils |
|
@@ -134,8 +134,11 @@ public class DictUtils |
|
134
|
{
|
134
|
{
|
|
135
|
StringBuilder propertyString = new StringBuilder();
|
135
|
StringBuilder propertyString = new StringBuilder();
|
|
136
|
List<SysDictData> datas = getDictCache(dictType);
|
136
|
List<SysDictData> datas = getDictCache(dictType);
|
|
137
|
-
|
|
|
|
138
|
- if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas))
|
137
|
+ if (StringUtils.isNull(datas))
|
|
|
|
138
|
+ {
|
|
|
|
139
|
+ return StringUtils.EMPTY;
|
|
|
|
140
|
+ }
|
|
|
|
141
|
+ if (StringUtils.containsAny(separator, dictLabel))
|
|
139
|
{
|
142
|
{
|
|
140
|
for (SysDictData dict : datas)
|
143
|
for (SysDictData dict : datas)
|
|
141
|
{
|
144
|
{
|
|
@@ -163,6 +166,48 @@ public class DictUtils |
|
@@ -163,6 +166,48 @@ public class DictUtils |
|
163
|
}
|
166
|
}
|
|
164
|
|
167
|
|
|
165
|
/**
|
168
|
/**
|
|
|
|
169
|
+ * 根据字典类型获取字典所有值
|
|
|
|
170
|
+ *
|
|
|
|
171
|
+ * @param dictType 字典类型
|
|
|
|
172
|
+ * @return 字典值
|
|
|
|
173
|
+ */
|
|
|
|
174
|
+ public static String getDictValues(String dictType)
|
|
|
|
175
|
+ {
|
|
|
|
176
|
+ StringBuilder propertyString = new StringBuilder();
|
|
|
|
177
|
+ List<SysDictData> datas = getDictCache(dictType);
|
|
|
|
178
|
+ if (StringUtils.isNull(datas))
|
|
|
|
179
|
+ {
|
|
|
|
180
|
+ return StringUtils.EMPTY;
|
|
|
|
181
|
+ }
|
|
|
|
182
|
+ for (SysDictData dict : datas)
|
|
|
|
183
|
+ {
|
|
|
|
184
|
+ propertyString.append(dict.getDictValue()).append(SEPARATOR);
|
|
|
|
185
|
+ }
|
|
|
|
186
|
+ return StringUtils.stripEnd(propertyString.toString(), SEPARATOR);
|
|
|
|
187
|
+ }
|
|
|
|
188
|
+
|
|
|
|
189
|
+ /**
|
|
|
|
190
|
+ * 根据字典类型获取字典所有标签
|
|
|
|
191
|
+ *
|
|
|
|
192
|
+ * @param dictType 字典类型
|
|
|
|
193
|
+ * @return 字典值
|
|
|
|
194
|
+ */
|
|
|
|
195
|
+ public static String getDictLabels(String dictType)
|
|
|
|
196
|
+ {
|
|
|
|
197
|
+ StringBuilder propertyString = new StringBuilder();
|
|
|
|
198
|
+ List<SysDictData> datas = getDictCache(dictType);
|
|
|
|
199
|
+ if (StringUtils.isNull(datas))
|
|
|
|
200
|
+ {
|
|
|
|
201
|
+ return StringUtils.EMPTY;
|
|
|
|
202
|
+ }
|
|
|
|
203
|
+ for (SysDictData dict : datas)
|
|
|
|
204
|
+ {
|
|
|
|
205
|
+ propertyString.append(dict.getDictLabel()).append(SEPARATOR);
|
|
|
|
206
|
+ }
|
|
|
|
207
|
+ return StringUtils.stripEnd(propertyString.toString(), SEPARATOR);
|
|
|
|
208
|
+ }
|
|
|
|
209
|
+
|
|
|
|
210
|
+ /**
|
|
166
|
* 删除指定字典缓存
|
211
|
* 删除指定字典缓存
|
|
167
|
*
|
212
|
*
|
|
168
|
* @param key 字典键
|
213
|
* @param key 字典键
|