Page<实体类> page = new Page<>(vo.getCurrent(), vo.getSize());//页数,每页长度 ArrayList<实体类> list = new ArrayList<>();// int startIndex = Math.toIntExact(Math.min((vo.getCurrent() - 1) * vo.getSize(), list.size())); int endIndex = Math.toIntExact(Math.min(startIndex + vo.getSize(), list.size())); List<实体类> records1 = list.subList(startIndex, endIndex); page.setTotal(list.size()); page.setRecords(records1); return page
list转page实现分页
于 2022-07-05 09:56:11 首次发布