我这样实现分页:
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和data吗?