fix: selectListByQueryAs 使用实体类对象导致查询不出来数据。

This commit is contained in:
Suomm 2023-06-13 09:49:46 +08:00
parent 6f30da2821
commit 5ab7a9e481

View File

@ -209,19 +209,18 @@ public class FlexConfiguration extends Configuration {
addResultMap(resultMap); addResultMap(resultMap);
} }
} }
}
/* /*
* 这里解释一下为什么要反转这个集合 * 这里解释一下为什么要反转这个集合
* *
* MyBatis 在解析 ResultMaps 的时候是按照顺序一个一个进行解析的对于有嵌套 * MyBatis 在解析 ResultMaps 的时候是按照顺序一个一个进行解析的对于有嵌套
* ResultMap 对象也就是 nestResultMap 需要放在靠前的位置首先解析 * ResultMap 对象也就是 nestResultMap 需要放在靠前的位置首先解析
* *
* 而我们进行递归 buildResultMapList 也好fillResultMapList 也好都是 * 而我们进行递归 buildResultMapList 是非嵌套 ResultMap 在集合最开始的位置
* 非嵌套 ResultMap 在集合最开始的位置所以要反转一下集合 hasNestedResultMaps * 所以要反转一下集合 hasNestedResultMaps ResultMap 对象放到集合的最
* ResultMap 对象放到集合的最前面 * 前面
*/ */
Collections.reverse(resultMapList); Collections.reverse(resultMapList);
}
return new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), ms.getSqlSource(), ms.getSqlCommandType()) return new MappedStatement.Builder(ms.getConfiguration(), ms.getId(), ms.getSqlSource(), ms.getSqlCommandType())
.resource(ms.getResource()) .resource(ms.getResource())