9mybatis三剑客之mybatis-pagehelper分页插件
9.1 文档地址:https://github.com/pagehelper/Mybatis-PageHelper
9.2 简介说明:这个插件会使编程简单,我们只需要填充数据就行,具体分页的逻辑多交给插件来做,mybatis-pagehelper劫持sql语句后,然后在执行select count计算 然后填充到分页节点字段中。
9.3 使用步骤:
在项目的pom.xml中配置mybatis-pagehelper的依赖
<!-- mybatis pager -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.github.miemiedev</groupId>
<artifactId>mybatis-paginator</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>0.9.4</version>
</dependency>
10配置Spring
https://spring.io/projects/spring-framework
项目配置Spring,导入mmall线上三个已经配好的文件
详细配置见五个文件对应的注解
11logback配置
拷贝线上文件logback.xml文件,详情见注解
12ftp服务器配置 -mshop.properties
ftp.server.ip=你的FTP服务器ip地址
ftp.user=mmallftp
ftp.pass=ftppassword
ftp.server.http.prefix=http://img.happymmall.com/
13IDEA工具优化
a-实时编译,要配置problem工具:
Settings-Build.....-Compiler-勾上右边的make project automatically
IDEA自动实时编译配置:主要用于编程过程,写错代码可以立马看到错误,提高效率
b-自动注解优化:主要防止IDEA认为错误,但实际项目可以正常运行,主要原因是因为Spring-auto导致的
Settings-搜索inspections -找到Inspection- 找到Spring-Spring Core -Code- Autowiring for Bean class,值修改成warming