/**
*mongoTemplate 聚合分组统计返回分组列表
*/
public Page<Log> groupStatistics(String compCampId, Long productId, Integer page, Integer size) {
if (page<1){page=1;}
Integer startRows = (page - 1) * size;
Sort sort = new Sort(Sort.Direction.DESC,"create_time");
List<String> patterns =new ArrayList<>();
patterns.add("scan_code_action");
patterns.add("pay_wechat_success");
Criteria criteria = Criteria.where("operation_name").in(patterns);
if (productId != null ){
criteria.and("module_id").is(productId);
}
if (compCampId != null ){
criteria.and("activity_id").is(compCampId);
}
SpringDataPageable pageable = new SpringDataPageable();
//开始页
pageable.setPagenumber(page);
//每页条数
pageable.setPagesize(size);
//排序
pageable.setSort(sort);
List<AggregationOperation> operations &#
mongoTemplate 聚合分组统计,aggregate分页
最新推荐文章于 2024-06-06 22:43:05 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)