PageHelper外掛程式的簡單入門使用步驟

2021-09-22 14:08:25 字數 1109 閱讀 8232

效果展示

pageinfo封裝的結果集的簡單說明

pagehelper是國內非常優秀的一款開源的mybatis分頁外掛程式,它支援基本主流與常用的資料庫,例如mysql、oracle、mariadb、db2、sqlite、hsqldb等。

注意:本次使用方式是基於oracle資料庫中操作的。

com.github.pagehelper

pagehelper

5.1.2

oracle

true

這裡僅僅只對pagehelper基本使用中的helperdialect、reasonable兩個基本功能實現引數做出說明。使用方式:在需要進行分頁的mybatis查詢方法前呼叫pagehelper.startpage靜態方法,跟在方法後的第乙個mybatis查詢方法會被進行分頁。

pageinfo是乙個用於封裝分頁物件的結果集,我們查詢的資料可以封裝在結果集中,可以方便我們在頁面拿到一些分頁資料資訊。pageinfo原始碼:

public class pageinfoimplements serializable
controller中將查詢的結果集封裝在pageinfo物件中:public modelandview findall(@requestparam(name = "page",required = true,defaultvalue = "1")int page, @requestparam(name = "size",required = true,defaultvalue = "4")int size)

在頁面中取出結果集屬性:

$$

$$$$

訂單詳情

編輯

簡單實現PageHelper外掛程式

第一步 新增jar包或者新增依賴 在pom中新增如下依賴 com.github.pagehelper pagehelper 最新版本 2.在spring的配置檔案中配置 params value1 第三步 使用pagehelper.startpage 方法 有其他方法這裡只寫這一種 service層...

Pagehelper外掛程式的使用

第一步 將工程匯入到eclipse裡面 第二步 斷開和svn的連線 第三步 將工程安裝到本地倉庫中就變成了乙個jar包,然後引用他的路徑即可使 第四步 需要對page在sqlmapconfig.xml中配置plugins 還有使用的什麼資料庫 方言和資料庫 第五步 需要在pom檔案配置 不記得在 配...

PageHelper分頁外掛程式

com.github.pagehelper pagehelper 5.1.2 1.在mybatis中配置 此時並沒有spring來管理mybatis 2.使用spring容器管理 此時mybatis已交由spring容器管理 1.helperdialect 分頁外掛程式會自動檢測當前的資料庫鏈結,自...