求解关于mybatis各种版本的resultMap返回DTO类型问题

本人大四软件工程菜鸟一枚,目前处于实习阶段,公司暂时也没分配什么项目,于是闲余时间本人把自己的毕业设计给修改修改。

本来这个项目是一个普通的SSM框架的web项目,基于Maven管理,后来我想把它整合到Springboot上面,于是出现了现在这个问题。

我之前用的mybatis的jar包是3.2.8的,整到springboot上面之后由于父pom版本问题,升级到了mybatis3.5.0,问题贴上

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 16
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplateSqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)atcom.sun.proxy.SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.Proxy74.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:84)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
at com.sun.proxy.$Proxy82.queryAllUser(Unknown Source)
at org.yk.tbboom.test.jj(test.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)求解关于mybatis各种版本的resultMap返回DTO类型问题这是测试的方法,很明显日志显示返回值问题,查询多个结果但是接收的对象只能接收一个,这是什么原因呢,我之前那个项目就不会报错,PostUserDTO是我在mybatis的xml一对多的映射关联
求解关于mybatis各种版本的resultMap返回DTO类型问题
求解关于mybatis各种版本的resultMap返回DTO类型问题求解关于mybatis各种版本的resultMap返回DTO类型问题
这种写法在高版本的mybatis就会导致DTO不能接收多个返回值问题,必须改成
List 才可以接收。
求解关于mybatis各种版本的resultMap返回DTO类型问题
而直接用DTO对象接收返回值的这种写法在mybatis3.2.8里面完全没问题,就是到了新版本之后DTO接收参数就受限制了,不能接收多个返回值,本人才疏学浅,不太了解其中机制,想请大佬们给指点迷津。