PageHelper stepped pit

The beginning of life and death can not divide page, only the default before 10. Engage in one afternoon, playing numerous breakpoints are tested not go wrong where.
Sike from work and to fast 8:00, just when I've been desperate, and finally try out, the page.getTotal () to spread to the front just fine. . .

public TableDataInfo project(@RequestParam(name = "pageSize", required = false)int pageSize, @RequestParam(name = "pageNum", required = false)int pageNum){
        TableDataInfo table = new TableDataInfo();

        Page<Enterprise> page = PageHelper.startPage(pageNum,pageSize);

        List<Enterprise> list = enterpriseService.selectEnterpriseList(enterprise);

               for(Enterprise data : list){
              ProjectDto project = new ProjectDto();
              project.setId(data.getId());
              project.setName(data.getEnterpriseName());
              project.setType(Integer.parseInt(type));
              project.setLocation(data.getProvince()+data.getCity());
              projectList.add(project);
              }
            table.setRows(projectList);
        table.setTotal(page.getTotal());    
        return table;
}

Guess you like

Origin www.cnblogs.com/initx/p/11402275.html