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. codeforces1213F tarjan缩点+拓扑排序

    题意 给定两个长度为n的排列p和q,构造一个字符串s满足\(s[p_i]<=s[p_{i+1}]\)和\(s[q_i]<=s[q_{i+1}]\),且满足字符串中不同字符的个数不少于k. ...

  2. tomcat控制前台到后台的乱码问题

    1.找到tomcat中的conf文件下的server.xml文件. 2.点击打开后找到 <Connector  port="8080" protocol="HTTP ...

  3. 基于nodejs将mongodb的数据实时同步到elasticsearch

    一.前言 因公司需要选用elasticsearch做全文检索,持久化存储选用的是mongodb,但是希望mongodb里面的数据发生改变可以实时同步到elasticsearch上,一开始主要使用ela ...

  4. 【java】简介(一)

    应用:web后端开发.android-app开发.大数据应用开发 学习:java会过时,但程序设计的思想不会过时 特点:1.面向对象,跨平台,语法比c++简单 2.以字节码的形式运行在虚拟机上 3.自 ...

  5. Linux学习笔记:fuser和lsof

    fuser 和 lsof 可以用于系统安全检查.用fuser查看哪些用户和进程在某些地方作什么:fuser -cu /root 简略显示fuser -muv /mnt3 分列显示 lsof 拥有更多的 ...

  6. Objective-C如何自己实现一个for-each语法形式

    我们在用Objective-C编写程序时,很多时候会用到NSArray来作为线性列表来使用.我们在枚举这个数组所有元素的使用可以通过下列方法进行: for(id obj in anArray) { } ...

  7. 数据分析 - Power BI 链接 mysql 数据分析

    链接数据库 点击确定后选择数据库, 然后输入用户名密码, 选择级别选择指定的数据库即可 之后弹出的导航器中即可有可预览的数据 更加推荐使用 再链接数据库的时候高级查询的 sql 中进行 sql 的执行 ...

  8. python flask url参数

    python flask url参数 常见 url 传参中都是 xxx?xxx=xxx 问题来了 flask中我没有找到 关于xx? 问号的使用方式 是不是flask就不支持这种方式 如果有 rout ...

  9. Qt编写安防视频监控系统6-面板开关

    一.前言 面板开关功能是整个系统最人性化的功能之一,可以对主界面中左侧右侧的各个小面板进行显示和隐藏,当隐藏的时候,另外的同级面板自动拉伸填充,这样就不会显得空洞,直接在每个面板的右上角提供了关闭按钮 ...

  10. Pycharm连接windows上python

    首先我们需要下载一个Python安装包,然后将安装包解压到某个盘符下, 然后我们打开Pycharm软件,点击左上角的File菜单,接着选择Settings选项,如下图所示 在弹出的Settings界面 ...