fix: 解决字段中存在注解@ExcelDictFormat(readConverterExp = "0=未纳管,1=已纳管")时,导出的excel中的options下拉项为:0=未纳管,1=已纳管;而不是:未纳管,已纳管;的情况。

This commit is contained in:
luziyang 2024-04-24 17:03:05 +08:00
parent ded2a32fdf
commit 7494adeafc
2 changed files with 6 additions and 2 deletions

View File

@ -107,7 +107,11 @@ public class ExcelDownHandler implements SheetWriteHandler {
options = new ArrayList<>(values); options = new ArrayList<>(values);
} else if (StrUtil.isNotBlank(converterExp)) { } else if (StrUtil.isNotBlank(converterExp)) {
// 如果指定了确切的值则直接解析确切的值 // 如果指定了确切的值则直接解析确切的值
options = StrUtil.split(converterExp, format.separator(), true, true); List<String> rawOptions = StrUtil.split(converterExp, format.separator(), true, true);
for (String s : rawOptions) {
List<String> split = StrUtil.split(s, "=", true, true);
options.add(split.get(1));
}
} }
} else if (field.isAnnotationPresent(ExcelEnumFormat.class)) { } else if (field.isAnnotationPresent(ExcelEnumFormat.class)) {
// 否则如果指定了@ExcelEnumFormat则使用枚举的逻辑 // 否则如果指定了@ExcelEnumFormat则使用枚举的逻辑

View File

@ -362,7 +362,7 @@ public class ExcelUtil {
} }
} }
} else { } else {
if (itemArray[1].equals(propertyValue)) { if (propertyValue.contains(itemArray[1])) {
return itemArray[0]; return itemArray[0];
} }
} }