Mybatis 报错Mapper method 'xxx' has an unsupported return type

2022-12-07,,,,

报错原因:

出现这种错误,说明sql语句执行成功,只是返回类型出了问题

解决方法:

insert、delete、update操作默认返回一个int类型的整数,将增删改的接口改成int或者void即可。

select操作返回的类型可以是自定义的Map或者是List(目前遇到的),这里等我总结了resultType相关知识再回来补充!

没有解决前: insert返回值用的是Dept类,但实际上需要传2个参数,而Dept则是三个参其中一个是自增主键,因此返回的不全就会报错。  改成Void就解决了;

Mybatis 报错Mapper method 'xxx' has an unsupported return type的相关教程结束。

《Mybatis 报错Mapper method 'xxx' has an unsupported return type.doc》

下载本文的Word格式文档,以方便收藏与打印。