Springboot- pagehelper使用
1.添加pagehelper依赖
<dependency>
<groupId>org.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.3.</version>
</dependency>
2.在yml配置
# 分页查询
pagehelper:
helper-dialect: mysql
# 查询合理化,如果查询页码小于1,则按第一页查询,查询页码大于最后一页,则查询最后一页 reasonable: true
3.controller
/**
* page 你要查询第几页
* 每页多少行
*/
public Page<Map> findContexts(Integer page, Interger rows){ // 启用分页
// PageHelper中会自动帮我们生成limit 分布语句
// 以及自动帮我们执行查询总数的CountSQL
PageHelper.startPage(page, rows);
Page<Map> list = (Page)contentMapper.findAll();
return list; }
@RequestMapping("/list")
@ResponseBody
public Map list(Integer page, Integer limit){
Page<Map> p = userService.findContents(page, limit);
// layui对前台返回的数据是有格式要求的
Map result = new HashMap();
result.put("code",);
result.put("count",page.size)
result.put("data",page);
return result;
}
Springboot- pagehelper使用的更多相关文章
- springboot pagehelper分页无效
springboot pagehelper分页无效 遇到的问题把所有的数据都查出来了 -然后跟踪代码发现PageHelper.startPage没有生效,生成的sql也没有分页的信息 依赖也引入了 & ...
- Springboot pageHelper总结
Springboot上使用pageHelper总结 1. 在pom.xml 中引入依赖 <!--pagehelper--> <dependency> <groupId&g ...
- spring-boot PageHelper
分页插件PageHelper 参看了pagehelper-spring-boot,使用起来非常放方便,关于更多PageHelper可以点击https://github.com/pagehelper/M ...
- pageHelper没有分页效果的问题
配置完全都没有问题 springboot pagehelper分页怎么都不管用 而且所有的信息记录全部都查出来了 解决方法: PageHelper.startPage(pageNum,pageSize ...
- 原理解密 → Spring AOP 实现动态数据源(读写分离),底层原理是什么
开心一刻 女孩睡醒玩手机,收到男孩发来一条信息:我要去跟我喜欢的人表白了! 女孩的心猛的一痛,回了条信息:去吧,祝你好运! 男孩回了句:但是我没有勇气说不来,怕被打! 女孩:没事的,我相信你!此时女孩 ...
- springboot使用之二:整合mybatis(xml方式)并添加PageHelper插件
整合mybatis实在前面项目的基础上进行的,前面项目具体整合请参照springboot使用之一. 一.整合mybatis 整合mybatis的时候可以从mybatis官网下载mybatis官网整合的 ...
- SpringBoot+Mybatis+ Druid+PageHelper 实现多数据源并分页
前言 本篇文章主要讲述的是SpringBoot整合Mybatis.Druid和PageHelper 并实现多数据源和分页.其中SpringBoot整合Mybatis这块,在之前的的一篇文章中已经讲述了 ...
- Springboot 系列(十二)使用 Mybatis 集成 pagehelper 分页插件和 mapper 插件
前言 在 Springboot 系列文章第十一篇里(使用 Mybatis(自动生成插件) 访问数据库),实验了 Springboot 结合 Mybatis 以及 Mybatis-generator 生 ...
- Spring boot入门(三):SpringBoot集成结合AdminLTE(Freemarker),利用generate自动生成代码,利用DataTable和PageHelper进行分页显示
关于SpringBoot和PageHelper,前篇博客已经介绍过Spring boot入门(二):Spring boot集成MySql,Mybatis和PageHelper插件,前篇博客大致讲述了S ...
- SpringBoot整合系列-PageHelper分页插件
原创作品,可以转载,但是请标注出处地址:https://www.cnblogs.com/V1haoge/p/9971043.html SpringBoot整合MyBatis分页插件PageHelper ...
随机推荐
- 巨蟒python全栈开发django6: FBV&CBV&&单表查询的其他方法
练习CBV用法 截图中的action="/cbv/",应该是这样 上边红图,说明mysql有问题,需要重启一下 返回,输入的内容 @wrapper==>cbv=wrapper ...
- POJ 1860 Currency Exchange【bellman_ford判断是否有正环——基础入门】
链接: http://poj.org/problem?id=1860 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#probl ...
- 《挑战程序设计竞赛》2.1 深度优先搜索 POJ2386 POJ1979 AOJ0118 AOJ0033 POJ3009
POJ2386 Lake Counting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 25366 Accepted: ...
- PLSQL 用的让自己更舒心点!
每天开发时候 ,有时候会疲劳! 改下你的PLSQL 字体吧!
- 发挥inline-block作用
.pay-type { // 同行 display: inline-flex; padding: 0 @pay-type_2imgs_padding-width; } .pay-type_icon { ...
- [mysql]清除单表大量数据方法(需保留部分数据)
大半夜的在删除线上的日志数据,需要清理的大概有1亿八千万条...任务艰巨. 毕业前没学过数据库,所以对于如何清理大量数据还真一时不知道该怎么办才好.刚开始确实想过对表进行重命名的方式来处理,不过当时因 ...
- DevExpress控件-lookupedit的使用方法详解(图文)转http://blog.csdn.net/qq395537505/article/details/50920508
绑定数据源: lookupedit.Properties.ValueMember = 实际要用的字段; //相当于editvalue lookupedit.Properties.DisplayMemb ...
- Centos简介(一)
Centos作为主流的一种Linux操作系统,我们选用Centos,主要是免费,以及稳定. Centos详细介绍,请参考 百度百科
- Java的OO与多态
this的用法 class Banana { void f(int i) {} }Banana a = new Banana(), b = new Banana();a.f(1);b.f(2);若只有 ...
- Django报:builtin_function_or_method' object is not iterable
def detail(request,hero_id): hero=models.HeroInfo.objects.get(id=hero_id) return render_to_response( ...