异常信息:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'startNum' not found. Available parameters are [arg2, arg1, arg0, param3, param1, param2]
解决:
如果你的mapper接口的参数有多个,每个参数都加上@Param注解
示例:
mapper
List<ReadDetail> listMyReadRecord(@Param("userId")Long userId,
@Param("startNum") Integer startNum,
@Param("pageSize") Integer pageSize);
mapper.xml
select * from 表名 as detail
where detail.deleted = 0
and detail.user_id = #{userId}
order by create_time desc
limit ${startNum},${pageSize};