mybatis-mapper / mapper

MyBatis Mapper
https://mapper.mybatis.io
Apache License 2.0
325 stars 47 forks source link

遇到一个奇怪的问题,启动项目之后,第一次查询,返回的是null #27

Closed yao00jun closed 1 year ago

yao00jun commented 2 years ago

启动项目之后,第一次查询,会遇到如下问题,再次查询就不会了。好奇怪 单个查询 mapper.selectOne(T) 返回的实体 里面的部分属性 是null 多个查询 mapper.selectList(null) 返回的 集合 List 的size 是20 但是 List 里面全是null 不知道是什么原因,使用版本是 1.0.3 查看打印的SQL是正常的SQL直接去数据库查也是正常的结果

yao00jun commented 2 years ago

发现去掉 autoResultMap 就正常了

abel533 commented 2 years ago

autoResultMap 时,查询SQL字段应该没有别名,去掉后会有别名。

abel533 commented 2 years ago

最新版本测试没有发现问题。