mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
fix: replaceResultMap error
This commit is contained in:
parent
bc6694a8a6
commit
9b12d5f75b
@ -187,7 +187,7 @@ public class FlexConfiguration extends Configuration {
|
|||||||
//获取结果的类型
|
//获取结果的类型
|
||||||
Class<?> clazz = resultMap.getType();
|
Class<?> clazz = resultMap.getType();
|
||||||
//判断是否为表实体类
|
//判断是否为表实体类
|
||||||
if (clazz.getDeclaredAnnotation(Table.class) != null) {
|
if (clazz.getDeclaredAnnotation(Table.class) != null && isDefaultResultMap(ms.getId(), resultMap.getId())) {
|
||||||
TableInfo tableInfo = TableInfoFactory.ofEntityClass(clazz);
|
TableInfo tableInfo = TableInfoFactory.ofEntityClass(clazz);
|
||||||
ms = replaceResultMap(ms, tableInfo);
|
ms = replaceResultMap(ms, tableInfo);
|
||||||
}
|
}
|
||||||
@ -196,6 +196,16 @@ public class FlexConfiguration extends Configuration {
|
|||||||
super.addMappedStatement(ms);
|
super.addMappedStatement(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为默认的 resultMap,也就是未配置 resultMap
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isDefaultResultMap(String statementId, String resultMapId) {
|
||||||
|
// 参考 {@code MapperBuilderAssistant.getStatementResultMaps}
|
||||||
|
return resultMapId.equals(statementId + "-Inline");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 替换 entity 查询的 ResultMap
|
* 替换 entity 查询的 ResultMap
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user