fix: fix and close #I8PQLC

This commit is contained in:
michael 2023-12-24 09:56:28 +08:00
parent 03a0e176b6
commit 1a02e80a25
2 changed files with 4 additions and 3 deletions

View File

@ -479,7 +479,7 @@ public class FlexDefaultResultSetHandler extends DefaultResultSetHandler {
private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject, private boolean applyPropertyMappings(ResultSetWrapper rsw, ResultMap resultMap, MetaObject metaObject,
ResultLoaderMap lazyLoader, String columnPrefix) throws SQLException { ResultLoaderMap lazyLoader, String columnPrefix) throws SQLException {
final List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); final Collection<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
boolean foundValues = false; boolean foundValues = false;
final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings(); final List<ResultMapping> propertyMappings = resultMap.getPropertyResultMappings();
for (ResultMapping propertyMapping : propertyMappings) { for (ResultMapping propertyMapping : propertyMappings) {
@ -1178,7 +1178,7 @@ public class FlexDefaultResultSetHandler extends DefaultResultSetHandler {
if (resultMapping.isSimple()) { if (resultMapping.isSimple()) {
final String column = prependPrefix(resultMapping.getColumn(), columnPrefix); final String column = prependPrefix(resultMapping.getColumn(), columnPrefix);
final TypeHandler<?> th = resultMapping.getTypeHandler(); final TypeHandler<?> th = resultMapping.getTypeHandler();
List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); Collection<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
// Issue #114 // Issue #114
if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) { if (column != null && mappedColumnNames.contains(column.toUpperCase(Locale.ENGLISH))) {
final Object value = th.getResult(rsw.getResultSet(), column); final Object value = th.getResult(rsw.getResultSet(), column);

View File

@ -30,6 +30,7 @@ import org.apache.ibatis.type.TypeHandler;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -84,7 +85,7 @@ public class FlexResultSetHandler extends FlexDefaultResultSetHandler {
String columnName = prependPrefix(mapping.getColumn(), columnPrefix); String columnName = prependPrefix(mapping.getColumn(), columnPrefix);
TypeHandler<?> typeHandler = mapping.getTypeHandler(); TypeHandler<?> typeHandler = mapping.getTypeHandler();
List<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix); Collection<String> mappedColumnNames = rsw.getMappedColumnNames(resultMap, columnPrefix);
if (columnName != null && mappedColumnNames.contains(columnName.toUpperCase(Locale.ENGLISH))) { if (columnName != null && mappedColumnNames.contains(columnName.toUpperCase(Locale.ENGLISH))) {
return typeHandler.getResult(rsw.getResultSet(), columnName); return typeHandler.getResult(rsw.getResultSet(), columnName);
} }