@Test public void listByPage() throws Exception { ConditionQuery query = new ConditionQuery(); query.setApplicationName("alipay-service"); PageParameter pageParameter = new PageParameter(1,8); query.setPageParameter(pageParameter); final CommonPager<LogVO> voCommonPager = logService.listByPage(query); }
@Override public CommonPager<LogVO> listByPage(final ConditionQuery query) { CommonPager<LogVO> voCommonPager = new CommonPager<>(); final int currentPage = query.getPageParameter().getCurrentPage(); final int pageSize = query.getPageParameter().getPageSize(); int start = (currentPage - 1) * pageSize; final String rootPath = RepositoryPathUtils.buildZookeeperPathPrefix(query.getApplicationName()); List<String> zNodePaths; List<LogVO> voList; int totalCount; try { if (StringUtils.isBlank(query.getTransId())) { zNodePaths = zooKeeper.getChildren(rootPath, false); totalCount = zNodePaths.size(); voList = findByPage(zNodePaths, rootPath, start, pageSize); } else { zNodePaths = Lists.newArrayList(query.getTransId()); totalCount = zNodePaths.size(); voList = findAll(zNodePaths, rootPath); } voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount)); voCommonPager.setDataList(voList); } catch (Exception e) { e.printStackTrace(); } return voCommonPager; }
ZookeeperLogServiceImpl implements LogService { @Override public CommonPager<LogVO> listByPage(final ConditionQuery query) { CommonPager<LogVO> voCommonPager = new CommonPager<>(); final int currentPage = query.getPageParameter().getCurrentPage(); final int pageSize = query.getPageParameter().getPageSize(); int start = (currentPage - 1) * pageSize; final String rootPath = RepositoryPathUtils.buildZookeeperPathPrefix(query.getApplicationName()); List<String> zNodePaths; List<LogVO> voList; int totalCount; try { if (StringUtils.isBlank(query.getTransId())) { zNodePaths = zooKeeper.getChildren(rootPath, false); totalCount = zNodePaths.size(); voList = findByPage(zNodePaths, rootPath, start, pageSize); } else { zNodePaths = Lists.newArrayList(query.getTransId()); totalCount = zNodePaths.size(); voList = findAll(zNodePaths, rootPath); } voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount)); voCommonPager.setDataList(voList); } catch (Exception e) { e.printStackTrace(); } return voCommonPager; } }
ZookeeperLogServiceImpl implements LogService { @Override public CommonPager<LogVO> listByPage(final ConditionQuery query) { CommonPager<LogVO> voCommonPager = new CommonPager<>(); final int currentPage = query.getPageParameter().getCurrentPage(); final int pageSize = query.getPageParameter().getPageSize(); int start = (currentPage - 1) * pageSize; final String rootPath = RepositoryPathUtils.buildZookeeperPathPrefix(query.getApplicationName()); List<String> zNodePaths; List<LogVO> voList; int totalCount; try { if (StringUtils.isBlank(query.getTransId())) { zNodePaths = zooKeeper.getChildren(rootPath, false); totalCount = zNodePaths.size(); voList = findByPage(zNodePaths, rootPath, start, pageSize); } else { zNodePaths = Lists.newArrayList(query.getTransId()); totalCount = zNodePaths.size(); voList = findAll(zNodePaths, rootPath); } voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount)); voCommonPager.setDataList(voList); } catch (Exception e) { e.printStackTrace(); } return voCommonPager; }  }
ZookeeperLogServiceImpl implements LogService { @Override public CommonPager<LogVO> listByPage(final ConditionQuery query) { CommonPager<LogVO> voCommonPager = new CommonPager<>(); final int currentPage = query.getPageParameter().getCurrentPage(); final int pageSize = query.getPageParameter().getPageSize(); int start = (currentPage - 1) * pageSize; final String rootPath = RepositoryPathUtils.buildZookeeperPathPrefix(query.getApplicationName()); List<String> zNodePaths; List<LogVO> voList; int totalCount; try { if (StringUtils.isBlank(query.getTransId())) { zNodePaths = zooKeeper.getChildren(rootPath, false); totalCount = zNodePaths.size(); voList = findByPage(zNodePaths, rootPath, start, pageSize); } else { zNodePaths = Lists.newArrayList(query.getTransId()); totalCount = zNodePaths.size(); voList = findAll(zNodePaths, rootPath); } voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount)); voCommonPager.setDataList(voList); } catch (Exception e) { e.printStackTrace(); } return voCommonPager; }  @Override CommonPager<LogVO> listByPage(final ConditionQuery query); @Override Boolean batchRemove(final List<String> ids, final String appName); @Override Boolean updateRetry(final String id, final Integer retry, final String appName); }
ZookeeperLogServiceImpl implements LogService { @Override public CommonPager<LogVO> listByPage(final ConditionQuery query) { CommonPager<LogVO> voCommonPager = new CommonPager<>(); final int currentPage = query.getPageParameter().getCurrentPage(); final int pageSize = query.getPageParameter().getPageSize(); int start = (currentPage - 1) * pageSize; final String rootPath = RepositoryPathUtils.buildZookeeperPathPrefix(query.getApplicationName()); List<String> zNodePaths; List<LogVO> voList; int totalCount; try { if (StringUtils.isBlank(query.getTransId())) { zNodePaths = zooKeeper.getChildren(rootPath, false); totalCount = zNodePaths.size(); voList = findByPage(zNodePaths, rootPath, start, pageSize); } else { zNodePaths = Lists.newArrayList(query.getTransId()); totalCount = zNodePaths.size(); voList = findAll(zNodePaths, rootPath); } voCommonPager.setPage(PageHelper.buildPage(query.getPageParameter(), totalCount)); voCommonPager.setDataList(voList); } catch (Exception e) { e.printStackTrace(); } return voCommonPager; }  @Override CommonPager<LogVO> listByPage(final ConditionQuery query); @Override Boolean batchRemove(final List<String> ids, final String appName); @Override Boolean updateRetry(final String id, final Integer retry, final String appName);  }