fix(excel): 字典/表字典分隔符从 _ 改为 , 解决含下划线值被截断

- ExcelAnnotationUtils split 分隔符由 _ 改为 ,
- AutoPoiDictConfig 去掉 --- escape 机制,改用 , 分隔
- 修复 username 等含下划线字段在 Excel 导入导出时被错误转换

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wsm
2026-07-13 15:18:53 +08:00
co-authored by Claude Opus 4.7
parent c260a08af9
commit 3de5614715
3 changed files with 6 additions and 14 deletions
@@ -13,7 +13,7 @@ public interface DictQuery {
* @param dictTable 字典表名(来自 @ExcelColumn.dictTable()
* @param dicCode 字典编码字段(来自 @ExcelColumn.dicCode()
* @param dicText 字典文本字段(来自 @ExcelColumn.dicText()
* @return 格式为 {"text_code", ...} 的数组,如 {"男_0", "女_1"};无结果返回 null 或空数组
* @return 格式为 {"text,code", ...} 的数组,如 {"男,0", "女,1"};无结果返回 null 或空数组
*/
String[] query(String dictTable, String dicCode, String dicText);
}
@@ -215,7 +215,7 @@ public final class ExcelAnnotationUtils {
static boolean isValidDictDisplay(String[] replace, String value) {
for (String s : replace) {
String[] arr = s.split("_");
String[] arr = s.split(",");
if (arr.length >= 2 && arr[0].equals(value)) {
return true;
}
@@ -359,7 +359,7 @@ public final class ExcelAnnotationUtils {
private static String replaceValue(String[] replace, String value) {
for (String s : replace) {
String[] arr = s.split("_");
String[] arr = s.split(",");
if (arr.length == 2 && value.equals(arr[1])) {
return arr[0];
}
@@ -398,7 +398,7 @@ public final class ExcelAnnotationUtils {
return;
}
for (String s : replace) {
String[] arr = s.split("_");
String[] arr = s.split(",");
if (arr.length >= 2) {
displayToCode.put(arr[0], arr[1]);
}