pom.xml中引入mysql
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.2</version> </dependency>
在applicationContext.xml中加入git
<property name="plugins"> <array> <bean class="com.github.pagehelper.PageInterceptor"> <property name="properties"> <!--使用下面的方式配置參數,一行配置一個 --> <value> helperDialect=mysql offsetAsPageNum=true rowBoundsWithCount=true pageSizeZero=true reasonable=true </value> </property> </bean> </array> </property>
service中使用
service的實現類中使用
PageHelper.startPage(page,size);github
controller 中使用sql
頁面的調用segmentfault
更多精彩文章請關注 王明昌博客