mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 09:38:26 +08:00
fix: 修复开启 mapUnderscoreToCamelCase = true 时, row 无法转换 entity 的问题
This commit is contained in:
parent
ac8aa468ed
commit
82286d55ae
@ -1151,7 +1151,8 @@ public class TableInfo {
|
|||||||
columnInfoMapping.forEach((column, columnInfo) -> {
|
columnInfoMapping.forEach((column, columnInfo) -> {
|
||||||
if (index <= 0) {
|
if (index <= 0) {
|
||||||
for (String rowKey : rowKeys) {
|
for (String rowKey : rowKeys) {
|
||||||
if (column.equalsIgnoreCase(rowKey)) {
|
// 修复: 开启 mapUnderscoreToCamelCase = true 时, row 无法转换 entity 的问题
|
||||||
|
if (rowKey.equalsIgnoreCase(column) || rowKey.equalsIgnoreCase(column.replace("_", ""))) {
|
||||||
setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey);
|
setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1160,7 +1161,8 @@ public class TableInfo {
|
|||||||
String newColumn = i <= 0 ? column : column + "$" + i;
|
String newColumn = i <= 0 ? column : column + "$" + i;
|
||||||
boolean fillValue = false;
|
boolean fillValue = false;
|
||||||
for (String rowKey : rowKeys) {
|
for (String rowKey : rowKeys) {
|
||||||
if (newColumn.equalsIgnoreCase(rowKey)) {
|
// 修复: 开启 mapUnderscoreToCamelCase = true 时, row 无法转换 entity 的问题
|
||||||
|
if (rowKey.equalsIgnoreCase(column) || rowKey.equalsIgnoreCase(column.replace("_", ""))) {
|
||||||
setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey);
|
setInstancePropertyValue(row, instance, metaObject, columnInfo, rowKey);
|
||||||
fillValue = true;
|
fillValue = true;
|
||||||
break;
|
break;
|
||||||
@ -1190,7 +1192,7 @@ public class TableInfo {
|
|||||||
if (rowValue != null && !metaObject.getSetterType(columnInfo.property).isAssignableFrom(rowValue.getClass())) {
|
if (rowValue != null && !metaObject.getSetterType(columnInfo.property).isAssignableFrom(rowValue.getClass())) {
|
||||||
rowValue = ConvertUtil.convert(rowValue, metaObject.getSetterType(columnInfo.property), true);
|
rowValue = ConvertUtil.convert(rowValue, metaObject.getSetterType(columnInfo.property), true);
|
||||||
}
|
}
|
||||||
rowValue = invokeOnSetListener(instance, columnInfo.getProperty(), rowValue);
|
rowValue = invokeOnSetListener(instance, columnInfo.property, rowValue);
|
||||||
metaObject.setValue(columnInfo.property, rowValue);
|
metaObject.setValue(columnInfo.property, rowValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user