6. paging query Teacher Information

Configuration tab plug-in

@Configuration
public class MybatisPlusConfig
{
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求  默认false
        // paginationInterceptor.setOverflow(false);
        // 设置最大单页限制数量,默认 500 条,-1 不受限制
        // paginationInterceptor.setLimit(500);
        // 开启 count 的 join 优化,只针对部分 left join
        return paginationInterceptor;
    }
}

controller returns paged data

	@GetMapping("findPage")
    public BaseResult pageTeacher()
    {
        // 2个参数分别是当前页和总条数
        Page<EduTeacher> eduTeacherPage = new Page<>(1,1);
        teacherService.page(eduTeacherPage,null);
        return  BaseResult.success(eduTeacherPage);
    }

Program structure.

Here Insert Picture Description

Published 236 original articles · won praise 10 · views 10000 +

Guess you like

Origin blog.csdn.net/gunsmoke/article/details/105222677