PageHelper分頁結果集不準確

2021-09-12 15:41:14 字數 304 閱讀 3865

pagehelper遇到resultmap的collection後,分頁總是不對。

由於pagehelper分頁總數是根據count(0)來計算出來的,而collection會把結果集合並(一對多的情況),計算總數在合併結果集之前,所以計算結果不對。同計數原理一樣,分頁實際在合併結果集之前進行的,這就導致了存在一對多情況時,實際返回的結果集個數和分頁要求的每頁結果集個數不一致,且如果最後一條記錄也涉及一對多時,結果集內容也不一定準確。

另外,對於mybatis(不使用分頁)一對多出現結果集合並問題,請參考解決。

PageHelper分頁實戰

1 首先pom檔案引入 com.github.pagehelper pagehelper 4.1.6 2 mybatisconfig.xml 處理 新增 listgetorderconfiglist param businesstype integer businesstype,param capi...

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層...