| public class RouteServiceImpl implements RouteService { |
| private RouteDao d = new RouteDaoImpl(); |
| @Override |
| public PageBean<Route> pageQuery(int cid,int currentPage,int pageSize){ |
| PageBean<Route> pb = new PageBean<>(); |
| |
| pb.setCurrentPage(currentPage); |
| |
| pb.setPageSize(pageSize); |
| |
| int totalCount = d.findTotalCount(cid); |
| pb.setTotalCount(totalCount); |
| |
| int start = (currentPage - 1) * pageSize; |
| List<Route> list = d.findByPage(cid,start,pageSize); |
| pb.setList(list); |
| |
| int totalPage = totalCount % pageSize == 0 ? totalCount/pageSize : (totalCount/pageSize) + 1; |
| pb.setTotalPage(totalPage); |
| return pb; |
| } |
| } |