Package cn.sinozg.applet.common.utils
Class DictUtil
java.lang.Object
cn.sinozg.applet.common.utils.DictUtil
字典工具类
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void清空字典缓存redis keystatic StringdictLabel(DictDataVo dictData, Locale locale) 获取到labelstatic Locale获取当前线程的 语言static StringfromThirdMapping(DictType dt, Object value) 通过第三方映射数据找到 本地值static StringgetCacheKey(String dictType) 设置cache keystatic List<DictDataVo>getDictCache(DictType key) 获取字典缓存static StringgetDictLabel(DictType dictType, String dictValue) 根据字典类型和字典值获取字典标签static StringgetDictLabel(DictType dictType, String dictValue, String separator) 根据字典类型和字典值获取字典标签static StringgetDictValue(DictType dictType, String dictLabel) 根据字典类型和字典标签获取字典值static StringgetDictValue(DictType dictType, String dictLabel, String separator) 根据字典类型和字典标签获取字典值private static DictDataVo获取到 数据字典static voidsetDictCache(Map<String, List<DictDataVo>> data) 设置字典缓存static StringtoThirdMapping(DictType dt, String value) 转为第三方映射值 字符串private static <T> TtoThirdMapping(DictType dt, String value, Class<T> clazz) 通过本地值找到 第三方映射数据static IntegertoThirdMappingInt(DictType dt, String value) 转为第三方映射值 整型private static String数据字典转义
-
Constructor Details
-
DictUtil
private DictUtil()
-
-
Method Details
-
setDictCache
设置字典缓存- Parameters:
data- 参数键 字典数据列表
-
getDictLabel
根据字典类型和字典值获取字典标签- Parameters:
dictType- 字典类型dictValue- 字典值- Returns:
- 字典标签
-
getDictValue
根据字典类型和字典标签获取字典值- Parameters:
dictType- 字典类型dictLabel- 字典标签- Returns:
- 字典值
-
getDictLabel
根据字典类型和字典值获取字典标签- Parameters:
dictType- 字典类型dictValue- 字典值separator- 分隔符- Returns:
- 字典标签
-
getDictValue
根据字典类型和字典标签获取字典值- Parameters:
dictType- 字典类型dictLabel- 字典标签separator- 分隔符- Returns:
- 字典值
-
tran
数据字典转义- Parameters:
dictType- 类型text- 文本separator- 分隔符value- 是否为值- Returns:
- 转义值
-
dictLocale
获取当前线程的 语言- Returns:
- 语言
-
clearDictCache
public static void clearDictCache()清空字典缓存 -
dictLabel
获取到label- Parameters:
dictData- 数据- Returns:
- label
-
getDictCache
获取字典缓存- Parameters:
key- 参数键- Returns:
- 字典数据列表
-
getCacheKey
设置cache key- Parameters:
dictType- 参数键- Returns:
- 缓存键key
-
dictKeyFun
redis key- Returns:
- key的function
-
fromThirdMapping
通过第三方映射数据找到 本地值- Parameters:
dt- 类型value- 值- Returns:
- 本地值
-
toThirdMapping
转为第三方映射值 字符串- Parameters:
dt- 类型value- 值- Returns:
- 第三方映射值
-
toThirdMappingInt
转为第三方映射值 整型- Parameters:
dt- 类型value- 值- Returns:
- 第三方映射值
-
toThirdMapping
通过本地值找到 第三方映射数据- Parameters:
dt- 类型value- 值- Returns:
- 本地值
-
matchDict
private static DictDataVo matchDict(DictType dt, String value, Function<DictDataVo, String> keyMapper) 获取到 数据字典- Parameters:
dt- 类型value- 值keyMapper- 匹配的数据- Returns:
- 数据字典
-