fix: fix and close #I94D33

This commit is contained in:
Michael Yang 2024-02-28 14:49:00 +08:00
parent 83c3afe542
commit a3a237b099

View File

@ -1246,9 +1246,10 @@ public class TableInfo {
Set<String> rowKeys = row.keySet(); Set<String> rowKeys = row.keySet();
columnInfoMapping.forEach((column, columnInfo) -> { columnInfoMapping.forEach((column, columnInfo) -> {
if (index <= 0) { if (index <= 0) {
String replace = column.replace("_", "");
for (String rowKey : rowKeys) { for (String rowKey : rowKeys) {
// 修复: 开启 mapUnderscoreToCamelCase = true row 无法转换 entity 的问题 // 修复: 开启 mapUnderscoreToCamelCase = true row 无法转换 entity 的问题
if (rowKey.equalsIgnoreCase(column) || rowKey.equalsIgnoreCase(column.replace("_", ""))) { if (rowKey.equalsIgnoreCase(column) || rowKey.equalsIgnoreCase(replace)) {
setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey); setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey);
} }
} }
@ -1256,9 +1257,10 @@ public class TableInfo {
for (int i = index; i >= 0; i--) { for (int i = index; i >= 0; i--) {
String newColumn = i <= 0 ? column : column + "$" + i; String newColumn = i <= 0 ? column : column + "$" + i;
boolean fillValue = false; boolean fillValue = false;
String replace = column.replace("_", "");
for (String rowKey : rowKeys) { for (String rowKey : rowKeys) {
// 修复: 开启 mapUnderscoreToCamelCase = true row 无法转换 entity 的问题 // 修复: 开启 mapUnderscoreToCamelCase = true row 无法转换 entity 的问题
if (rowKey.equalsIgnoreCase(column) || rowKey.equalsIgnoreCase(column.replace("_", ""))) { if (rowKey.equalsIgnoreCase(newColumn) || rowKey.equalsIgnoreCase(replace)) {
setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey); setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey);
fillValue = true; fillValue = true;
break; break;
@ -1270,6 +1272,7 @@ public class TableInfo {
} }
} }
}); });
//noinspection unchecked
return (T) instance; return (T) instance;
} }