mybatis-plus
在使用自定义的sql,分页查询时
IPage<Goods> page = goodsMapper.findGoodsByCla(
pages.getStatus(),
new Page<>(pages.getCurrent(), pages.getSize())
);出现异常:
nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 20] with root cause org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 20
new Page<>()对象必须为第一个参数,否则异常,TooManyResultsException
将Page移至第一个参数即可
IPage<Goods> page = goodsMapper.findGoodsByCla(
new Page<>(pages.getCurrent(), pages.getSize()),
pages.getStatus()
);版权声明:本文为weixin_50641683原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。