From f789d336bef5c111e1f7cdcbab1ff40c12618859 Mon Sep 17 00:00:00 2001 From: HouKunLin Date: Mon, 13 Dec 2021 16:29:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E5=80=BC=E4=BD=BF=E7=94=A8=E6=96=87=E6=9C=AC=E5=88=86=E9=9A=94?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=95=B0=E7=BB=84=E7=BB=93=E6=9E=9C=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=AD=97=E5=85=B8=E5=80=BC=E6=97=A0=E5=88=86=E9=9A=94?= =?UTF-8?q?=E7=AC=A6=E5=AF=BC=E8=87=B4=E6=97=A0=E6=95=B0=E6=8D=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20tag=20v1.4.6.1=20=E4=BF=AE=E5=A4=8D=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- changelog.md | 4 ++++ .../json/DictTextJsonSerializerDefault.java | 17 +++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 66f2c8b..1e3ed94 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ plugins { } group = 'com.houkunlin' -version = '1.4.6' +version = '1.4.6.1' sourceCompatibility = '1.8' description = """ 系统数据字典自动翻译成字典文本。可集合系统数据库中存储的用户数据字典,也可使用枚举做系统数据字典,主要用在返回数据给前端时自动把字典值翻译成字典文本信息; diff --git a/changelog.md b/changelog.md index 5b5ff20..1e31421 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # 更改日志 +## 1.4.6.1 版本 + +- fix: 修复字典值使用文本分隔转换数组结果时,字典值无分隔符导致无数据问题 + ## 1.4.6 版本 - feat: 增加树形结构数据的字典文本转换支持 diff --git a/src/main/java/com/houkunlin/system/dict/starter/json/DictTextJsonSerializerDefault.java b/src/main/java/com/houkunlin/system/dict/starter/json/DictTextJsonSerializerDefault.java index 2e30148..88bd020 100644 --- a/src/main/java/com/houkunlin/system/dict/starter/json/DictTextJsonSerializerDefault.java +++ b/src/main/java/com/houkunlin/system/dict/starter/json/DictTextJsonSerializerDefault.java @@ -178,18 +178,15 @@ private Object processArrayField(final Object[] fieldValues) { */ private Object processStringField(final String fieldValueString) { final String splitStr = array.split(); - if (fieldValueString.contains(splitStr)) { - final List texts = new ArrayList<>(); - final String[] splitValue = fieldValueString.split(splitStr); - for (final Object o : splitValue) { - final String dictValueText = obtainDictValueText(String.valueOf(o)); - if (!array.ignoreNull() || StringUtils.hasText(dictValueText)) { - texts.add(dictValueText); - } + final List texts = new ArrayList<>(); + final String[] splitValue = fieldValueString.split(splitStr); + for (final Object o : splitValue) { + final String dictValueText = obtainDictValueText(String.valueOf(o)); + if (!array.ignoreNull() || StringUtils.hasText(dictValueText)) { + texts.add(dictValueText); } - return obtainResult(texts); } - return obtainResult(Collections.emptyList()); + return obtainResult(texts); } /**