Spring Boot 整合Pagehelper(为什么PageHelper分页不生效)
引入包
https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter/1.2.10
<!--分页--><!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter --><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.2.10</version></dependency>
配置文件
import com.github.pagehelper.PageHelper;
import org.apache.ibatis.session.Configuration;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import java.util.Properties;/***配置文件* @author liwen406* @date 2019-04-20 12:14 2019-04-20 13:20*/
@org.springframework.context.annotation.Configuration
public class MyBatisConfig {/*** 目的防止驼峰命名规则* @return*/@Beanpublic ConfigurationCustomizer configurationCustomizer(){return new ConfigurationCustomizer(){@Overridepublic void customize(Configuration configuration) {configuration.setMapUnderscoreToCamelCase(true);}};}/*** 分页插件* @return*/@Beanpublic PageHelper pageHelper() {System.out.println("MyBatisConfiguration.pageHelper()");PageHelper pageHelper = new PageHelper();Properties p = new Properties();p.setProperty("offsetAsPageNum", "true");p.setProperty("rowBoundsWithCount", "true");p.setProperty("reasonable", "true");pageHelper.setProperties(p);return pageHelper;}
}
dao mapper
@Select("SELECT * from tbl_emp")List<Employee> selectByExample(Employee example);
Service
@Overridepublic List<Employee> selectByExample() {return projectInfodao.selectByExample(null);}
Controller
@GetMapping("/page/{start}/{end}")@ResponseBodypublic List<Employee> likeName(@PathVariable int start, @PathVariable int end) throws Exception {/** 第一个参数:第几页;* 第二个参数:每页获取的条数.*/PageHelper.startPage(start, end);return projectInfService.selectByExample();}
转载于:https://blog.51cto.com/357712148/2381845
Spring Boot 整合Pagehelper(为什么PageHelper分页不生效)相关推荐
- spring boot整合mybatis+通用mapper+pagehelper分页插件
spring boot整合mybatis+通用mapper+pagehelper分页插件 pom依赖 <?xml version="1.0" encoding="U ...
- Spring Boot 整合MyBatis(23)
Spring Boot 整合MyBatis Spring Boot 整合 Druid 引入依赖 配置 application.yml pring Boot 整合 tk.mybatis 引入依赖 配置 ...
- VUE+Spring Boot整合MyBatis实现前后端分离项目壁纸网站
目录 前言 一.项目运行 二.环境需要 三.技术栈 四.项目说明 五.后端代码 前言 每次换桌面,壁纸总是不好找,搜索图片得不到好的索引与反馈,很难找到自己喜欢的壁纸,而壁纸网站可以免去我们去寻找壁纸 ...
- 五、spring boot整合mybatis-plus
spring boot整合mybatis-plus 简介 mybatis 增强工具包,简化 CRUD 操作. 文档 http://mp.baomidou.com http://mybatis.plus ...
- springboot整合hibernate_峰哥说技术系列-17 .Spring Boot 整合 Spring Data JPA
今日份主题 Spring Boot 整合 Spring Data JPA JPA(Java Persistence API)是用于对象持久化的 API,是Java EE 5.0 平台标准的 ORM 规 ...
- Elasticsearch学习(3) spring boot整合Elasticsearch的原生方式
前面我们已经介绍了spring boot整合Elasticsearch的jpa方式,这种方式虽然简便,但是依旧无法解决我们较为复杂的业务,所以原生的实现方式学习能够解决这些问题,而原生的学习方式也是E ...
- Elasticsearch实战篇——Spring Boot整合ElasticSearch
2019独角兽企业重金招聘Python工程师标准>>> 当前Spring Boot很是流行,包括我自己,也是在用Spring Boot集成其他框架进行项目开发,所以这一节,我们一起来 ...
- Spring boot 整合Spring Security Jwt
记录学习Spring boot 整合Spring Security Jwt 学习参考 – 慢慢的干货 https://shimo.im/docs/OnZDwoxFFL8bnP1c/read 首先创建S ...
- ElasticSearch教程与实战:从搭建服务到Spring Boot整合
目录 写在前面 Elasticsearch是什么?可以解决什么问题? 关于Elasticsearch版本的选择 Elasticsearch的几个基本概念 索引(index) 类型(type) 文档(d ...
- 【SpringBoot学习】28、Spring Boot 整合 TKMybatis 通用 Mapper
文章目录 Spring Boot 整合 TKMybatis 自定义父类接口 新增接口 新增之后回显 Id 更新 删除 单查询 查询列表 计数 条件构造器 技术分享区 Spring Boot 整合 TK ...
最新文章
- 哪些电脑最适合做机器学习、数据科学和深度学习呢?这里有份调研报告
- Linux 6.8 root密码丢失找回
- Java技术:收集16 条 yyds 的代码规范,值得一读!
- Linux安装MariaDB(Mysql)和简单配置
- “恭喜那些拿到 Java 月薪 2 万 Offer 的人”
- InfoGAN详细介绍及特征解耦图像生成
- matlab矩阵倒数,求解:用MATLAB生成空间距离倒数矩阵后面板分析出现下面的几句警告...
- 开源GIS平台实战项目的总结
- Win10系统微信,QQ打语音听不见声音
- 物联网毕业设计 - 物联网毕设项目分享 有趣的毕设项目(单片机 嵌入式 物联网 stm32)
- 公式编辑器中如何修改字体?
- win7 计算机和控制面板突然打不开,显示服务器运行失败
- JS 数字,金额 用逗号 隔开(数字格式化)
- 积木式移动互联网App Hybrid框架-modular
- Cocos技术派 | TS版属性面板定义高级用法
- SpringBoot-配置actuator
- Android中APK打包流程
- 在VS2010中ActiveX控件注册方法,使用regsvr32命令
- element 合计
- 小i机器人软件工程师揭秘机器人的“脑细胞”NLU