feat: add support nested types for MappedStatementTypes.java

This commit is contained in:
Michael Yang 2024-08-23 16:54:04 +08:00
parent 3e72d5f22c
commit b98acf0b47
2 changed files with 3 additions and 2 deletions

View File

@ -143,7 +143,8 @@ public class FlexConfiguration extends Configuration {
MappedStatement ms = super.getMappedStatement(id); MappedStatement ms = super.getMappedStatement(id);
//动态 resultsMap方法名称为selectListByQuery //动态 resultsMap方法名称为selectListByQuery
Class<?> asType = MappedStatementTypes.getCurrentType(); Class<?> asType = MappedStatementTypes.getCurrentType();
if (asType != null) { //忽略掉查询 Rows 的方法
if (asType != null && !id.endsWith("selectRowsByQuery")) {
return MapUtil.computeIfAbsent(dynamicMappedStatementCache, id + ":" + asType.getName(), return MapUtil.computeIfAbsent(dynamicMappedStatementCache, id + ":" + asType.getName(),
clazz -> replaceResultMap(ms, TableInfoFactory.ofEntityClass(asType)) clazz -> replaceResultMap(ms, TableInfoFactory.ofEntityClass(asType))
); );

View File

@ -356,7 +356,7 @@ public class RelationManager {
queryWrapper.where(column(relation.getJoinSelfColumn()).eq(selfFieldValues.iterator().next())); queryWrapper.where(column(relation.getJoinSelfColumn()).eq(selfFieldValues.iterator().next()));
} }
mappingRows = mapper.selectListByQueryAs(queryWrapper, Row.class); mappingRows = mapper.selectRowsByQuery(queryWrapper);
if (CollectionUtil.isEmpty(mappingRows)) { if (CollectionUtil.isEmpty(mappingRows)) {
return; return;
} }