首页 > 其他分享 >Mybatis 报错Mapper method 'xxx' has an unsupported return type

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

时间:2022-10-31 13:11:28浏览次数:80  
标签:返回 Mapper return int unsupported 报错 Mybatis type

报错原因:

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

解决方法:

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

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

 

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

 

 

标签:返回,Mapper,return,int,unsupported,报错,Mybatis,type
From: https://www.cnblogs.com/ZhuAo/p/16843938.html

相关文章