请教波总最近我在用多表联查返回多表不同字段做分页查询用的jfinal的db.Db.paginate()做的分页但是执行的时候报错,Invalid argument value: java.lang.ArrayIndexOutOfBoundsException,数组越界,以下为源码望波总帮助解答。
public Page<Record> getByParamInOrderItem(Map<String, Object> values, int pageNumber, int pageSize) {
StringBuffer sql = new StringBuffer(
"FROM ppzu_in_order_item item LEFT JOIN ppzu_in_order o ON item.order_id = o.id WHERE 1=1 ");
List<Object> params = new ArrayList<Object>();
if (values.containsKey("serialNo")) {
sql.append(" and o.serial_no like ?");
params.add("%" + values.get("serialNo") + "%");
}
if (values.containsKey("startDate")) {
sql.append(" and o.in_date >= ?");
params.add(values.get("startDate"));
}
if(values.containsKey("endDate")){
sql.append(" and o.in_date <= ?");
params.add(values.get("endDate"));
}
if (values.containsKey("stateId")) {
sql.append(" and o.state_id = ?");
params.add(values.get("stateId"));
}
if (values.containsKey("storeId")) {
sql.append(" and o.store_id = ?");
params.add(values.get("storeId"));
}
if (values.containsKey("comeType")) {
sql.append(" and o.come_type = ?");
params.add(values.get("comeType"));
}
String str = " FROM (SELECT o.id,"
+ "o.serial_no,"
+ "o.come_type,"
+ "o.store_id,"
+ "o.in_date,"
+ "o.state_id,"
+ "o.state_name,"
+ "item.goods_type,"
+ "item.count,"
+ "item.goods_name,"
+ "store.name "+sql.toString()+" ) inorder";
return Db.paginate(pageNumber, pageSize, "select inorder.* ", str, params);
}