1.maven依赖

<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>

2.mybatis.xml( 关于pagehelper    https://pagehelper.github.io/docs/)

<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- config params as the following -->
<property name="helperDialect" value="mysql"/>
</plugin>
</plugins>

3.Controller

@Controller
public class StudentController { @Autowired
private StuServiceImpl stuService; @ResponseBody
@RequestMapping("/all")
public PageInfo<Stu_info> list(int currentPage, int pageSize) {
return stuService.getAllStu(currentPage,pageSize);
}
}

4.service和实现类

接口:

public interface StuService {
public PageInfo<Stu_info> getAllStu(int currentPage, int pageSize);
} impl: @Service
public class StuServiceImpl implements StuService { @Autowired
private Stu_infoMapper stu_infoMapper; @Override
public PageInfo<Stu_info> getAllStu(int currentPage, int pageSize) { PageHelper.startPage(currentPage,pageSize); List<Stu_info> stuInfoList =stu_infoMapper.AllStu(); PageInfo pageInfo = new PageInfo(stuInfoList); return pageInfo;
}
}

5.dao和mapper

public List<Stu_info> AllStu();

  

 <select id="AllStu" resultMap="BaseResultMap">

           select  * from  stu_info ORDER BY id

  </select>

6.网址输入

http://localhost:8080/all?currentPage=2&pageSize=3

SSM+pagehelper分页的更多相关文章

  1. PageHelper分页实战(SSM整合)

    步骤一:引入SSM相关的jar包,包列表如下: 步骤二:创建或修改配置文件,配置文件清单如下: applicationContext.xml <?xml version="1.0&qu ...

  2. PageHelper分页插件的使用

    大家好!今天写ssm项目实现分页的时候用到pageHelper分页插件,在使用过程中出现了一些错误,因此写篇随笔记录下整个过程 1.背景:在项目的开发的过程中,为了实现所有的功能. 2.目标:实现分页 ...

  3. 17-SSM中通过pagehelper分页的实现

    SSM中通过pagehelper分页的实现 1. 在SSM框架的基础上实现,导包 <!-- 分页 --> <dependency> <groupId>com.git ...

  4. 如何在实际项目中使用PageHelper分页插件

    PageHelper是一个分页插件,能够简单快速的帮助开发人员完成常见的分页功能,你只需要简单的使用两行代码就可以完成一个分页效果- 最近做一个科创项目,使用Maven+SSM的环境,有分页的功能,于 ...

  5. 扩展-PageHelper分页插件

    1.PageHelper 分页插件简介 1) PageHelper是MyBatis中非常方便的第三方分页插件 2) 官方文档: https://github.com/pagehelper/Mybati ...

  6. 基于SSM的分页

    现在基本每一个项目都有用到分页,SSM也是当前企业用到的比较频繁的框架,这里我就总结一下基于SSM的分页: 一.首先我们要准备一个分页的工具类 /** * 分页 */ public class Pag ...

  7. Springboot 系列(十二)使用 Mybatis 集成 pagehelper 分页插件和 mapper 插件

    前言 在 Springboot 系列文章第十一篇里(使用 Mybatis(自动生成插件) 访问数据库),实验了 Springboot 结合 Mybatis 以及 Mybatis-generator 生 ...

  8. SpringBoot整合系列-PageHelper分页插件

    原创作品,可以转载,但是请标注出处地址:https://www.cnblogs.com/V1haoge/p/9971043.html SpringBoot整合MyBatis分页插件PageHelper ...

  9. SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页

    SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页 **SpringBoot+Mybatis使用Pagehelper分页插件自动分页,非常好用,不用在自己去计算和组装了. ...

随机推荐

  1. CF1140F Extending Set of Points 【按时间分治,并查集】

    题目链接:洛谷 首先我们考虑没有撤回操作的情况,就是将每一行和每一列看做一个点(代表行的称为白点,代表列的称为黑点),每个点$(x,y)$看做一条边. Extend操作实际上就是$x_1$行与$y_1 ...

  2. mysql报错码code=exited,status=2的解决方案

    由于电脑死机,导致MySQL无法重启. 解决方案看官方文档,设置完后重启失败,再把innodb_force_recovery = 1去掉就可以了 https://dev.mysql.com/doc/r ...

  3. codeforces#101194H. Great Cells(数学)

    题目链接: https://codeforces.com/gym/101194 题意: 在$n×m$的各自中填上$1$到$k$的数 定义Greate cell为严格大于同行和同列的格子 定义$A_g$ ...

  4. tomcat发布web项目

    转:https://www.cnblogs.com/skyblue-li/p/7888951.html Tomcat是一种Web服务器,我们自己做好了一个Web项目,就可以通过Tomcat来发布.服务 ...

  5. spring事务在web环境中失效的问题

    今天温习一下spring事务的时候,出现了一种诡异的现象,在java环境中测试事务是可以的.然后到web下测试事务就没用了.spring.xml配置 spring-mvc.xml配置 后来百度发现是因 ...

  6. Docker容器数据券

    1.是什么? 2.能干嘛? 3.数据卷 ——容器内添加 方式一:直接命令添加 1).命令 2).在宿主机上新建并添加内容 3).查看容器内相应共享文件夹,发现宿主机的文件夹下发生变化,会同步到容器内的 ...

  7. git如何添加子模块以便方便使用别人维护的模块?

    答: 添加过程如下: 1. 在当前项目的源码下执行一下命令来添加子模块 git submoduel add <other_repository_url> <dir_name> ...

  8. Swift 自动引用计数(ARC)

    Swift 使用自动引用计数(ARC)这一机制来跟踪和管理应用程序的内存 通常情况下我们不需要去手动释放内存,因为 ARC 会在类的实例不再被使用时,自动释放其占用的内存. 但在有些时候我们还是需要在 ...

  9. 实时流Streaming大数据:Storm,Spark和Samza

    当前有许多分布式计算系统能够实时处理大数据,这篇文章是对Apache的三个框架进行比较,试图提供一个快速的高屋建瓴地异同性总结. Apache Storm 在Storm中,你设计的实时计算图称为top ...

  10. PLSQL Developer配置OCI连接远程数据库

    转: PLSQL Developer配置OCI连接远程数据库 当前环境: 本机系统:Win7 32位 PLSQL版本:9.06 数据库版本:10.2 32位 下面开始具体操作. 1.在Oracle官网 ...