共計 2129 個字符,預計需要花費 6 分鐘才能閱讀完成。
自動寫代碼機器人,免費開通
這篇文章主要介紹如何實現(xiàn) ssm 分頁,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
頁面用 bootstrapTable 實現(xiàn)(配置查詢的參數(shù)即可),前提得引入 bootstrapTable 的 css,js
function load() {var typeid = $( #typeid).val();
$(#exampleTable).bootstrapTable({
method : get , // 服務器數(shù)據(jù)的請求方式 get or post
url : xxx/base/supSupt/list , // 服務器數(shù)據(jù)的加載地址
iconSize : outline ,
toolbar : #exampleToolbar ,
striped : true, // 設置為 true 會有隔行變色效果
dataType : json , // 服務器返回的數(shù)據(jù)類型
pagination : true, // 設置為 true 會在底部顯示分頁條
singleSelect : false, // 設置為 true 將禁止多選
pageSize : 10, // 如果設置了分頁,每頁數(shù)據(jù)條數(shù)
pageNumber : 1, // 如果設置了分布,首頁頁碼
search : true, // 是否顯示搜索框,給參數(shù)就可以搜索了
showColumns : false, // 是否顯示內容下拉框(選擇顯示的列)clickToSelect:true,
sortOrder: desc ,
sidePagination : server , // 設置在哪里進行分頁,可選值為 client 或者
queryParams : function(params) {// 后臺有個 Query 類,只要添加了鍵值對而且是表中有的他會自動弄進去
return {
// 說明:傳入后臺的參數(shù)包括 offset 開始索引,limit 步長,sort 排序列,order:desc 或者, 以及所有列的鍵值對
limit : params.limit,
offset : params.offset,
sort: createdat , 根據(jù)創(chuàng)建時間(對應映射文件的條件)order: desc , 排序
type:typeid
columns : [
checkbox : true
field : code ,
title : 編碼
field : comp ,
title : 公司名
field : busilicence ,
title : 信用代碼
field : law ,
title : 法定代表人
field : tel ,
title : 聯(lián)系電話
}
2. 控制器
@ResponseBody
@GetMapping(/list)
@RequiresPermissions(base:supSupt:add)
public PageUtils list(@RequestParam Map String, Object params){
// 查詢列表數(shù)據(jù)
Query query = new Query(params);
List SupSuptSupVO supSuptList = supSuptService.getSupListExcludeSuptpyeId(query);
int total = supSuptService.getSupListCountExcludeSuptpyeId(query);
PageUtils pageUtils = new PageUtils(supSuptList, total);
return pageUtils;
}
工具類
分頁的工具類 mybatis 映射文件
select id= getSupListExcludeSuptpyeId resultType= com.xxx.bid.base.vo.SupSuptVO
select * from bid_sup where id not in (
select ss.supid from bid_sup_supt as ss inner join bid_sup as s on ss.supid = s.id
where
if test= typeid != null and typeid != and ss.typeid = #{typeid} /if
/where
choose
when test= sort != null and sort.trim() !=
order by ${sort} ${order}
/when
otherwise
order by ls desc
/otherwise
/choose
if test= offset != null and limit != null
limit #{offset}, #{limit}
/if
/select
select id= getSupListCountExcludeSuptpyeId resultType= int
select count(*) from bid_sup where id not in (
select ss.supid from bid_sup_supt as ss inner join bid_sup as s on ss.supid = s.id
where
if test= typeid != null and typeid != and ss.typeid = #{typeid} /if
/where
/select
以上是“如何實現(xiàn) ssm 分頁”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注丸趣 TV 行業(yè)資訊頻道!
向 AI 問一下細節(jié)
丸趣 TV 網(wǎng) – 提供最優(yōu)質的資源集合!
正文完
發(fā)表至: 數(shù)據(jù)庫
2023-12-18