日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

springboot+thymeleaf+pageHelper带条件分页查询

發(fā)布時間:2023/12/20 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 springboot+thymeleaf+pageHelper带条件分页查询 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

html層

<div><a class="num"><b th:text="'共 '+ ${result.resultMap['pages']}+ ' 頁'"></b></a><a class="num" th:if="${result.resultMap['hasPreviousPage']} == true" th:href="@{'/report/receivePage?currentPage=' + ${result.resultMap['prePage']} + '&sCus=' + ${result.sCus}+ '&sIsPaid=' + ${result.sIsPaid}+ '&start=' + ${result.start}+ '&end=' + ${result.end}}" >上一頁</a><a class="num" th:href="@{'/report/receivePage?currentPage=' + ${result.resultMap['nextPage']}+'&sCus=' + ${result.sCus}+ '&sIsPaid=' + ${result.sIsPaid}+ '&start=' + ${result.start}+ '&end=' + ${result.end}}" th:if="${result.resultMap['hasNextPage']} == true">下一頁</a> </div>

controller層

if(!"null".equals(dto.getsCus())){conditionMap.put("sCus",dto.getsCus());}if(dto.getStart() != null && dto.getStart() != ""){// 將時間字符串轉(zhuǎn)換為時間對象DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");try {conditionMap.put("start",format1.parse(dto.getStart()));} catch (ParseException e) {e.printStackTrace();} }

dto

public class ConditionDto {private Integer currentPage=1;private Integer pageSize;private String start;private String end;private String sCus; }

?

最近在使用springboot+thymeleaf+pageHelper做帶條件分頁的時候遇到了一些問題,我們在做帶條件查詢分頁的時候,搜索條件需要拼接到url路徑后面,不然翻頁的時候,查詢出來的數(shù)據(jù)是不帶條件的。但是直接拼接到url后面,所有的數(shù)據(jù)都會被轉(zhuǎn)換成String類型,這時,我們需要在controller層做一下判斷與數(shù)據(jù)類型的轉(zhuǎn)換。問題暫時解決了,不過代碼還有待優(yōu)化!

轉(zhuǎn)載于:https://www.cnblogs.com/pandaQQQ/p/10577038.html

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結

以上是生活随笔為你收集整理的springboot+thymeleaf+pageHelper带条件分页查询的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。