语句countSql.params().putAll(sql.params()); 参数未被重用,countSql语句中的参数为NULL
使用的示例代码如下所示:
Sql sql = Sql.queryRecord("select m.* from xxxxxxxx where id=@Id");
sql.params().set("id", 1234);
dao.execute(sql);
List<Record> list = sql.getList(Record.class);
Sql countSql = Sql.fetchInt("select count(1) from where id=@id"); // 带count的sql
countSql.params().putAll(sql.params()); // 重用参数
dao.execute(countSql);
int count = countSql.getInt();