随笔 - 20  文章 - 0  评论 - 0  阅读 - 7005

Mybatis-plus 参数中 分页参数的位置 引发的报错

{
    "timestamp": "2022-01-17T06:47:15.437+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "nested exception is org.apache.ibatis.exceptions.TooManyResultsException: 
Expected one result (or null) to be returned by selectOne(), but found: 3", "path": "/jiany/list" }

这个是在Postman中测试时 的报错

 

Servlet.service() for servlet [dispatcherServlet] in context with path [] 
threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException:
nested exception is org.apache.ibatis.exceptions.TooManyResultsException:
Expected one result (or null) to be returned by selectOne(), but found: 3] with root cause

这个是我Java代码中的报错

 

Page<Jiany> jianyPage = new Page<>(page,size);

IPage<Jiany> jianylist = jianyMapper.jianylist(vo,jianyPage);

这个是解决前我的参数位置

 

1
IPage<Jiany> jianylist = jianyMapper.jianylist(jianyPage,vo);<br>//这个是解决后我的参数位置 <br>//这样报错就解决了  <br>//分页的page参数必须放在第一位  这样报错就解决了 
posted on   菊_酒  阅读(491)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

欢迎阅读『Mybatis-plus 参数中 分页参数的位置 引发的报错』
点击右上角即可分享
微信分享提示