欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

mybatis-plus分頁如何接收前端參數(shù)limit和page

 更新時間:2022年01月11日 15:54:32   作者:wy1045536776  
這篇文章主要介紹了mybatis-plus分頁如何接收前端參數(shù)limit和page,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

記錄一下layui+springboot+mybatis-plus實現(xiàn)分頁

controller層

在這里插入圖片描述

dao層

在這里插入圖片描述

創(chuàng)建config包

在這里插入圖片描述

創(chuàng)建返回前端的實體類

在這里插入圖片描述

再創(chuàng)建數(shù)據(jù)庫相對應的實體類就可以了

前端接收到信息

在這里插入圖片描述

mybatis-plus中Page類各個參數(shù)的具體含義

mybatis-plus中Page類

mybatisplus在使用分頁時需要傳入一個Page對象,這里對該對象做一些解釋

打開Page的源碼我們可以看到Page實現(xiàn)了IPage接口

private static final long serialVersionUID = 8545996863226528798L;
? ? protected List<T> records;
? ? protected long total;
? ? protected long size;
? ? protected long current;
? ? protected List<OrderItem> orders;
? ? protected boolean optimizeCountSql;
? ? protected boolean isSearchCount;
? ? protected boolean hitCount;
? ? protected String countId;
? ? protected Long maxLimit;

它的構造參數(shù)居然有5個

讓我們眼花繚亂。因此在這里對每一個參數(shù)進行一個詳細的介紹。

參數(shù)名參數(shù)類型默認值描述
    
recordsList<T> 用來存放查詢出來的數(shù)據(jù)
totallong 返回記錄的總數(shù)
sizelong10每頁顯示條數(shù)
currentlong1當前頁
ordersList<OrderItem> 排序字段信息
optimizeCountSqlbooleantrue自動優(yōu)化 COUNT SQL
isSearchCountbooleantrue是否進行 count 查詢,設置false后不會返回total
hitCountbooleanfalse是否命中count緩存
countIdString  
maxLimitLongnull單頁分頁條數(shù)限制

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

最新評論