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. NVMe - NB的特性

    翻译一下,纯粹是为了记住这些特性: NVMe provides the following benefits: ● Ultra-low latency 非常低的延迟 ● Very high throu ...

  2. Linux进程通信之mmap

    mmap()函数: void *mmap(void* addr,size_t length,int port,int flags,int fd,off_t offset); 返回:成功:返回创建的映射 ...

  3. vue中父组件如何监听子组件值的变化

    vue中我们会遇到很多父子组件通信的需求, 下面简单列一下,父子组件通信的几种情况 1:父组件向子组件传值:使用prop向子组件传值: 2:子组件实时监听父组件传来的值的变化:使用watch去监听父组 ...

  4. scrapy框架之spider

    爬取流程 Spider类定义如何爬取指定的一个或多个网站,包括是否要跟进网页里的链接和如何提取网页内容中的数据. 爬取的过程是类似以下步骤的循环: 1.通过指定的初始URL初始化Request,并指定 ...

  5. springboot之搭建第一个helloworld程序

    1.下载基本框架 在网站:https://start.spring.io/ 全部默认,基本没有改动 选择依赖,当然也可以自己在pom.xml加,我们直接在这里选择. 只选择Spring Web Sta ...

  6. kali系统firefox浏览器默认语言改为中文设置方法

    kali中的Firefox浏览器默认为英文,这对英语不够好的我来讲,自然是很麻烦的,下面讲一下如何将语言设置为中文. 1.打开终端,输入 apt -y install firefox-esr-l10n ...

  7. html5获取地理位置和定位

    1.H5地理位置定位功能 首先判断用户浏览器是否支持该功能,目前大多数现代浏览器均支持,获取位置信息需用户授权同意 function getLocation(){ if (navigator.geol ...

  8. 数据分析 - sql 业务相关练习题

    数据库    userinfo , orderinfo 表 两个 userId 彼此对应 题目 解题 不同月份的下单人数 用户在同一个月份会下多个单,这里进行去重 未支付的脏数据去除 统计用户三月份的 ...

  9. 18.flannel

    18.flannel docker有四种常用网络 bridge joined opended 直接共享使用节点的网络名称空间 none k8s网络通信: 容器间的通信: 同一个Pod内的多个容器之间通 ...

  10. android设置gps自动开启

    1.第一种方法 private void toggleGPS() { Intent gpsIntent = new Intent(); gpsIntent.setClassName("com ...