美文网首页
分页插件pagehelper 引入和应用

分页插件pagehelper 引入和应用

作者: 笨的很想飞 | 来源:发表于2023-03-20 23:07 被阅读0次

1.pom 引入

<!--    pagehelper  分页插件-->
    <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
    <dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper</artifactId>
      <version>5.1.10</version>
    </dependency>

2.应用

StudentDAO studentDAO = MyBatisUtil.getMapper(StudentDAO.class);
        PageHelper.startPage(1,1);
        List<Student> students = studentDAO.listStudentsByGender("女");
        PageInfo<Student> pageInfo = new PageInfo<Student>(students);
//        pageInfo 数据及分页信息
        for (Student s:
                pageInfo.getList()) {
            System.out.println(s);
        }

相关文章

网友评论

      本文标题:分页插件pagehelper 引入和应用

      本文链接:https://www.haomeiwen.com/subject/jdbprdtx.html