我这样实现分页:
List<Products> products = productRepository.findAllProducts(productsRequest.getInitiatorType(), "ACTIVE",
new PageRequest(page, 100, Sort.Direction.DESC, "insertDate"));
但是我怎样才能得到这个查询的总大小?只有这样的重复查询?
@Query("SELECT t FROM Products t WHERE t.isApproved = true AND t.partnerId = ?1 AND t.categories.status = ?2")
List<OpcClProducts> findAllOpcClProducts(String senderId, String status, Pageable pageable);
@Query("SELECT COUNT(t) FROM Products t WHERE t.isApproved = true AND t.partnerId = ?1 AND t.categories.status = ?2")
long getTotalCount(String senderId, String status);
并调用 2 查询:对于 totalCount 和对于数据?