SSM+pagehelper分页
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分页的更多相关文章
- PageHelper分页实战(SSM整合)
步骤一:引入SSM相关的jar包,包列表如下: 步骤二:创建或修改配置文件,配置文件清单如下: applicationContext.xml <?xml version="1.0&qu ...
- PageHelper分页插件的使用
大家好!今天写ssm项目实现分页的时候用到pageHelper分页插件,在使用过程中出现了一些错误,因此写篇随笔记录下整个过程 1.背景:在项目的开发的过程中,为了实现所有的功能. 2.目标:实现分页 ...
- 17-SSM中通过pagehelper分页的实现
SSM中通过pagehelper分页的实现 1. 在SSM框架的基础上实现,导包 <!-- 分页 --> <dependency> <groupId>com.git ...
- 如何在实际项目中使用PageHelper分页插件
PageHelper是一个分页插件,能够简单快速的帮助开发人员完成常见的分页功能,你只需要简单的使用两行代码就可以完成一个分页效果- 最近做一个科创项目,使用Maven+SSM的环境,有分页的功能,于 ...
- 扩展-PageHelper分页插件
1.PageHelper 分页插件简介 1) PageHelper是MyBatis中非常方便的第三方分页插件 2) 官方文档: https://github.com/pagehelper/Mybati ...
- 基于SSM的分页
现在基本每一个项目都有用到分页,SSM也是当前企业用到的比较频繁的框架,这里我就总结一下基于SSM的分页: 一.首先我们要准备一个分页的工具类 /** * 分页 */ public class Pag ...
- Springboot 系列(十二)使用 Mybatis 集成 pagehelper 分页插件和 mapper 插件
前言 在 Springboot 系列文章第十一篇里(使用 Mybatis(自动生成插件) 访问数据库),实验了 Springboot 结合 Mybatis 以及 Mybatis-generator 生 ...
- SpringBoot整合系列-PageHelper分页插件
原创作品,可以转载,但是请标注出处地址:https://www.cnblogs.com/V1haoge/p/9971043.html SpringBoot整合MyBatis分页插件PageHelper ...
- SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页
SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页 **SpringBoot+Mybatis使用Pagehelper分页插件自动分页,非常好用,不用在自己去计算和组装了. ...
随机推荐
- JavaWeb_(Mybatis框架)主配置文件介绍_四
系列博文: JavaWeb_(Mybatis框架)JDBC操作数据库和Mybatis框架操作数据库区别_一 传送门 JavaWeb_(Mybatis框架)使用Mybatis对表进行增.删.改.查操作_ ...
- Python 中操作 MySQL
引入模块 在py文件中引入pymysql模块 from pymysql import * Connection 对象 用于建立与数据库的连接 创建对象:调用connect()方法 conn=conne ...
- Linux设备驱动程序 之 后备高速缓存
设备驱动程序常常会反复的分配很多相同大小的内存块:内核实现了后备高速缓存来对此进行支持,以反复的使用这些相同的内存块: 创建 Linux内核的高速缓存管理有时被称为“slab分配器”:因此,相关函数和 ...
- 第11组 Alpha冲刺(6/6)
第11组 Alpha冲刺(6/6) 队名 不知道叫什么团队 组长博客 https://www.cnblogs.com/xxylac/p/11913626.html 作业博客 https://edu ...
- vagrant box镜像百度下载地址
1.centos7 链接:https://pan.baidu.com/s/1JuIUo4HL0lm1EtUKaoMpaA提取码:w9a8 2.vagrant-ubuntu-server-16.04-x ...
- 使用vagrant一键部署本地php开发环境(一)
一:我们为什么需要用这玩意 我们在开发中经常会面临的问题:环境不一致,有人用Mac有人用Windos还有几个用linux的,而我们的服务器都是linux. 在我本地是可以的啊,我测了都,没有问题 ...
- MySQL 临时表和复制表
MySQL 临时表在我们需要保存一些临时数据时是非常有用的.临时表只在当前连接可见,当关闭连接时,Mysql会自动删除表并释放所有空间. 临时表在MySQL 3.23版本中添加,如果你的MySQL版本 ...
- LevelDB深入浅出之整体架构
LevelDB是一个可持久化的KV数据库引擎,由Google传奇工程师Jeff Dean和Sanjay Ghemawat开发并开源.无论从设计还是代码上都可以用精致优雅来形容,非常值得细细品味.本文将 ...
- 004-jdk-数据结构-ArrayList、LinkedList
一.ArrayList概述 数组集合,无容量限制,非线程安全 ArrayList.Vector是线性表,使用Object数组作为容器去存储数据的,添加了很多方法维护这个数组,使其容量可以动态增长,极大 ...
- 阶段5 3.微服务项目【学成在线】_day04 页面静态化_02-freemarker介绍