当前使用版本(必填,否则不予处理)
mybatisplus 3.4.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
多表关联分页查询的时候
因为count分页条数时候因为 只count了主表 导致在查询时候,带的如果是leftjoin 表中的参数 导致带入不进去
重现步骤(如果有就写完整)
count的sql SELECT COUNT(*) FROM order_info WHERE equipment_id = ?
查询的sql select * from order_info left join (select count(1) from order_info where create_time between #{startTime} and #{endTime}) tt on 1=1 WHERE equipment_id=#{equipmentId}
报错信息
Cause: java.sql.SQLException: Parameter index out of range (number > number of parameters, which is number).
Comment From: liaogaoyu
feat: 分页count识别 left join (subSelect) 优化 应该是这个优化导致的bug,目前只能在最外层套一层子查询解决
Comment From: qmdx
测试 https://gitee.com/baomidou/mybatis-plus/commit/dc68281958c808fc1561e3fae31299e7be6ad62d 并无错误,可能是版本问题,请关注 3.4.3.2发布升级后测试