在控制台显示sql语句的配置
<!-- 在控制台显示sql语句-->
<settings>
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
配置分页插件
首先要在pom.xml文件配置依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<!-- 配置mybatis的插件,-->
<plugins>
<!-- 这里使用的是分页插件,作用是拦截sql语句并生成对应的分页语句
他会针对不同的数据库生成不同的分页语句-->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- 配置分页插件的一些属性-->
<!-- 配置数据库的方言,当前使用的-->
<property name="helperDialect" value="mysql"/>
<!-- 启用注解参数分页来支持-->
<property name="supportMethodsArguments" value="true"/>
<!-- 启用分页合理化,当pageNum<=0时,就设置为1-->
<property name="reasonable" value="true"/>
</plugin>
</plugins>