NutzCN Logo
问答 nutzboot中sql.params().putAll()未能重用参数的问题
发布于 2229天前 作者 tuchief 1794 次浏览 复制 上一个帖子 下一个帖子
标签:

语句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();
5 回复

还有这种操作。。。

方案1,Daos.queryCount

方案2,使用NutMap放参数,然后分别sql.params.putAll(map);

额,版本差异?最新版吗?

@wendal 恩的,最新版

哦, 看来是我的锅

添加回复
请先登陆
回到顶部