|
@ -91,31 +91,31 @@ public class DictUtils |
|
|
{ |
|
|
{ |
|
|
StringBuilder propertyString = new StringBuilder(); |
|
|
StringBuilder propertyString = new StringBuilder(); |
|
|
List<SysDictData> datas = getDictCache(dictType); |
|
|
List<SysDictData> datas = getDictCache(dictType); |
|
|
|
|
|
if (StringUtils.isNull(datas)) |
|
|
if (StringUtils.isNotNull(datas)) |
|
|
{ |
|
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.containsAny(separator, dictValue)) |
|
|
{ |
|
|
{ |
|
|
if (StringUtils.containsAny(separator, dictValue)) |
|
|
for (SysDictData dict : datas) |
|
|
{ |
|
|
{ |
|
|
for (SysDictData dict : datas) |
|
|
for (String value : dictValue.split(separator)) |
|
|
{ |
|
|
{ |
|
|
for (String value : dictValue.split(separator)) |
|
|
if (value.equals(dict.getDictValue())) |
|
|
{ |
|
|
{ |
|
|
if (value.equals(dict.getDictValue())) |
|
|
propertyString.append(dict.getDictLabel()).append(separator); |
|
|
{ |
|
|
break; |
|
|
propertyString.append(dict.getDictLabel()).append(separator); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
for (SysDictData dict : datas) |
|
|
{ |
|
|
{ |
|
|
for (SysDictData dict : datas) |
|
|
if (dictValue.equals(dict.getDictValue())) |
|
|
{ |
|
|
{ |
|
|
if (dictValue.equals(dict.getDictValue())) |
|
|
return dict.getDictLabel(); |
|
|
{ |
|
|
|
|
|
return dict.getDictLabel(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -134,8 +134,11 @@ public class DictUtils |
|
|
{ |
|
|
{ |
|
|
StringBuilder propertyString = new StringBuilder(); |
|
|
StringBuilder propertyString = new StringBuilder(); |
|
|
List<SysDictData> datas = getDictCache(dictType); |
|
|
List<SysDictData> datas = getDictCache(dictType); |
|
|
|
|
|
if (StringUtils.isNull(datas)) |
|
|
if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) |
|
|
{ |
|
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.containsAny(separator, dictLabel)) |
|
|
{ |
|
|
{ |
|
|
for (SysDictData dict : datas) |
|
|
for (SysDictData dict : datas) |
|
|
{ |
|
|
{ |
|
@ -162,6 +165,48 @@ public class DictUtils |
|
|
return StringUtils.stripEnd(propertyString.toString(), separator); |
|
|
return StringUtils.stripEnd(propertyString.toString(), separator); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 根据字典类型获取字典所有值 |
|
|
|
|
|
* |
|
|
|
|
|
* @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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 删除指定字典缓存 |
|
|
* 删除指定字典缓存 |
|
|
* |
|
|
* |
|
|