时间:2021-07-01 10:21:17 帮助过:140人阅读
Criteria criteria = Criteria.where("callerId").is(recorded.getCallerId());
criteria.and(“status”).is(Recorded.SUCCESS);
if(startTime!=null&&endTime!=null){
criteria.andOperator(
Criteria.where("createTime").gte(startTime),
Criteria.where("createTime").lte(endTime)
);
}
query.addCriteria(criteria);
//mongoTemplate.count计算总数
long total = mongoTemplate.count(query, Recorded.class);
// mongoTemplate.find 查询结果集
List<Recorded> items = mongoTemplate.find(query.with(pageable), Recorded.class);
return new PageImpl(items, pageable, total);
}
springboot jpa mongodb 多条件分页查询
标签:status pos count tar stat list operator opera create