PageHelper分頁外掛程式的使用

2021-08-21 06:19:49 字數 1285 閱讀 5232

外掛程式叫做pagehelper如果你也在用

mybatis

,建議嘗試該分頁外掛程式,這個一定是最方便使用的分頁外掛程式。

該外掛程式目前支援oracle,mysql,mariadb,sqlite,hsqldb,postgresql六種資料庫分頁。

使用方法:

第一步:需要在sqlmapconfig.xml,配置乙個

plugin

。第二步:在sql語句執行之前,新增乙個

pagehelper.startpage(page,rows);

第三步:取分頁結果。建立乙個pageinfo物件需要引數,查詢結果返回的

list

。從pageinfo

物件中取分頁結果。

修改sqlmapconfig.xml

xmlversion

="1.0"

encoding

="utf-8"

?>

doctype

configuration

public

"- config 3.0//en"

"">

<

configuration

>

<

plugins

>

<

plugin

interceptor

="com.github.pagehelper.pagehelper"

>

<

property

name

="dialect"

value

="mysql"

/>

plugin

>

plugins

>

configuration

>

**測試

public

class

testpagehelper }

PageHelper分頁外掛程式

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

外掛程式分頁 pageHelper

步驟 1.導包 3.serivce中,給到具體的分頁的頁碼page,每頁條數 size 4.controller中把得到的資料儲存到pageinfo。5.到達頁面在pom檔案中導包 com.github.pagehelper pagehelper 5.1.2 mysql true 在service層...

分頁外掛程式PageHelper

com.github.pagehelper pagehelper 4.1.0 啟動位址,埠 server.port 8088 資料庫連線池配置 spring.datasource.type com.alibaba.druid.pool.druiddatasource spring.datasourc...