springboot+thymeleaf+pageHelper带条件分页查询
<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() != ""){
// 将时间字符串转换为时间对象
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路径后面,不然翻页的时候,查询出来的数据是不带条件的。但是直接拼接到url后面,所有的数据都会被转换成String类型,这时,我们需要在controller层做一下判断与数据类型的转换。问题暂时解决了,不过代码还有待优化!
springboot+thymeleaf+pageHelper带条件分页查询的更多相关文章
- SpringBoot-07:SpringBoot整合PageHelper做多条件分页查询
------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 本篇博客讲述如何在SpringBoot中整合PageHelper,如何实现带多个条件,以及PageInfo中的 ...
- SpringBoot整合PageHelper做多条件分页查询
https://yq.aliyun.com/articles/619586 本篇博客讲述如何在SpringBoot中整合PageHelper,如何实现带多个条件,以及PageInfo中的属性的中文解释 ...
- thinkphp 带条件分页查询
thinkphp 带条件分页查询:form表单传值时候,method='get'. 用 get 传值
- Hibernate查询,返回new对象(注意这个新定义的类要有构造函数),使用sql带条件分页查询并且把结果显示到一个对象的集里面的解决方案
IIndexDao package com.ucap.netcheck.dao; import com.ucap.netcheck.combination.beans.IndexCombinat ...
- springboot jpa mongodb 多条件分页查询
public Page<Recorded> getRecordeds(Integer page, Integer size, Recorded recorded) { if (page&l ...
- springboot结合mybatis使用pageHelper插件进行分页查询
1.pom相关依赖引入 <dependencies> <dependency> <groupId>org.springframework.boot</grou ...
- asp.net mvc多条件+分页查询解决方案
开发环境vs2010 css:bootstrap js:jquery bootstrap paginator 原先只是想做个mvc的分页,但是一般的数据展现都需要检索条件,而且是多个条件,所以就变成了 ...
- ASPNETCOREAPI 跨域处理 SQL 语句拼接 多条件分页查询 ASPNET CORE 核心 通过依赖注入(注入服务)
ASPNETCOREAPI 跨域处理 AspNetCoreApi 跨域处理 如果咱们有处理过MV5 跨域问题这个问题也不大. (1)为什么会出现跨域问题: 浏览器安全限制了前端脚本跨站点的访问资源, ...
- 【java】spring-data-jpa 集成hibernate实现多条件分页查询
初次接触spring-data-jpa,实现多条件分页查询. 基础环境 Spring Boot+spring-data-jpa+hibernate+mysql 1.接口 要继承这个接口,这个接口提供了 ...
随机推荐
- java 实现文件上传下载以及查看
项目的目录结构 代码 IOUtils.java package cn.edu.zyt.util; import java.io.IOException; import java.io.InputSt ...
- JavaScript基础知识(Date 的方法)
Date 的方法 console.log(typeof Date);// "function" Date的实例 console.log(typeof new Date()); // ...
- TCP/IP详解--拥塞控制 & 慢开始、拥塞避免、快重传和快恢复。
https://www.cnblogs.com/losbyday/p/5847041.html 膜拜大佬,看完了就会
- Luogu 2766 - 最长不下降子序列问题 - [LIS问题][DP+网络流]
题目链接:https://www.luogu.org/problemnew/show/P2766 题解(大量参考https://blog.csdn.net/ZscDst/article/details ...
- USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)
usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...
- day24:继承
1,复习1 # 面向对象编程 # 思想:角色的抽象,创建类,创建角色(实例化),操作这些示例 # 面向对象的关键字 class 类名: 静态属性 = 'aaa' def __init__(self): ...
- nmap用法
Nmap 7.70SVN ( https://nmap.org ) Usage: nmap [Scan Type(s)] [Options] {target specification} TARGET ...
- JMeter压测基础(三)——Mysql数据库
JMeter压测基础(三)——Mysql数据库 环境准备 mysql驱动 JMeter jdbc配置 JMeter jdbc请求 1.下载mysql驱动:mysql-connector-java.ja ...
- (Linux)CentOS7下安装JDK 1.8
参考:http://www.cnblogs.com/sxdcgaq8080/p/7492426.html 1.首先查看CentOS7是否有自带的JDK ,一般Linux会自动下载安装Open JDK ...
- SharePoint 2010 查看dll的PublicKeyToken值方法
在做asp.net开发过程中,偶尔对有些dll,进行强制签名,那么在注册dll到gac的时候,就需要知道dll的PublicKeyToken值,如何通过简单的方法,来获得这个值呢,下面是一个很好又实用 ...