limit分页查询

 controller层

    @ApiOperation("员工分页查询")
    @GetMapping("/page")
    public Result page(EmployeePageQueryDTO employeePageQueryDTO){
        log.info("员工分页查询,参数为{}",employeePageQueryDTO);
        PageResult pageResult=employeeService.pageQuery(employeePageQueryDTO);
        return Result.success(pageResult);
    }

 Service层

    PageResult pageQuery(EmployeePageQueryDTO employeePageQueryDTO);

  ServiceImpl层

使用PageHelper插件进行自动分页

    @Override
    public PageResult pageQuery(EmployeePageQueryDTO employeePageQueryDTO) {
        PageHelper.startPage(employeePageQueryDTO.getPage(),employeePageQueryDTO.getPageSize());
       Page page = employeeMapper.pageQuery(employeePageQueryDTO);
       long total=page.getTotal();
      List records=page.getResult();
      return new PageResult(total,records);
    }

 mapper层

 配置动态xml

    Page pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
    

 

 

 

 

 

 

你可能感兴趣的:(java,服务器,前端)