如何 获取总条数?

我之前是通过这样的查询方式,查询当前条件的所有数据,
image
因为这样可以不用拼装页面上的条件参数,直接loader的getCondition()追加就可以。。

现在我现在想 查询本页面条件下的总数据条数,需要怎么修改代码?
我发现这样写不行,无法追加页面条件。
image

可以这样:

  LoadContext<Product> loadContext = new LoadContext<>(metadata.getClass(Product.class));
  LoadContext.Query query = loadContext.setQueryString("select e from leot_Product e where e.name = 'haha'");
  query.setCondition(productsDl.getCondition());

  long count = dataManager.getCount(loadContext);

执行的结果:
image