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).
当前使用版本(必填,否则不予处理)
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).