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);

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

 

 IPage<Jiany> jianylist = jianyMapper.jianylist(jianyPage,vo);
//这个是解决后我的参数位置 
//这样报错就解决了  
//分页的page参数必须放在第一位 这样报错就解决了 
posted on 2022-01-17 15:01  菊_酒  阅读(527)  评论(0)    收藏  举报