话不多说直接贴代码
1 @GetMapping("/getCdrDetailList/{billingCycleId}/{acctId}/{acctItemTypeId}/{pageNum}")
2 public List getCdrDetailList(@PathVariable("billingCycleId") Long billingCycleId,
3 @PathVariable("acctId") Long acctId,
4 @PathVariable("acctItemTypeId") Long acctItemTypeId,
5 @PathVariable("pageNum") int pageNum) {
6 // 重要:因为涉及多表结果集合并,每个表的数据组装逻辑差距极大,并且根据入参条件查询出来的结果集数量很小,故考虑使用java内存list的lambda分页
7 List cdrDetailList = ledgerQryService.getCdrDetailList(billingCycleId, acctId, acctItemTypeId);
8 int pageSize = 15;
9 // lambda分页
10 List result = cdrDetailList.stream().skip(pageSize * (pageNum - 1)).limit(pageSize).collect(Collectors.toList());11 return result;
12 }