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() != ""){
  // 将时间字符串转换为时间对象
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带条件分页查询的更多相关文章

  1. SpringBoot-07:SpringBoot整合PageHelper做多条件分页查询

    ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 本篇博客讲述如何在SpringBoot中整合PageHelper,如何实现带多个条件,以及PageInfo中的 ...

  2. SpringBoot整合PageHelper做多条件分页查询

    https://yq.aliyun.com/articles/619586 本篇博客讲述如何在SpringBoot中整合PageHelper,如何实现带多个条件,以及PageInfo中的属性的中文解释 ...

  3. thinkphp 带条件分页查询

    thinkphp 带条件分页查询:form表单传值时候,method='get'. 用 get 传值

  4. Hibernate查询,返回new对象(注意这个新定义的类要有构造函数),使用sql带条件分页查询并且把结果显示到一个对象的集里面的解决方案

     IIndexDao package com.ucap.netcheck.dao; import com.ucap.netcheck.combination.beans.IndexCombinat ...

  5. springboot jpa mongodb 多条件分页查询

    public Page<Recorded> getRecordeds(Integer page, Integer size, Recorded recorded) { if (page&l ...

  6. springboot结合mybatis使用pageHelper插件进行分页查询

    1.pom相关依赖引入 <dependencies> <dependency> <groupId>org.springframework.boot</grou ...

  7. asp.net mvc多条件+分页查询解决方案

    开发环境vs2010 css:bootstrap js:jquery bootstrap paginator 原先只是想做个mvc的分页,但是一般的数据展现都需要检索条件,而且是多个条件,所以就变成了 ...

  8. ASPNETCOREAPI 跨域处理 SQL 语句拼接 多条件分页查询 ASPNET CORE 核心 通过依赖注入(注入服务)

    ASPNETCOREAPI 跨域处理 AspNetCoreApi 跨域处理 如果咱们有处理过MV5 跨域问题这个问题也不大. (1)为什么会出现跨域问题:  浏览器安全限制了前端脚本跨站点的访问资源, ...

  9. 【java】spring-data-jpa 集成hibernate实现多条件分页查询

    初次接触spring-data-jpa,实现多条件分页查询. 基础环境 Spring Boot+spring-data-jpa+hibernate+mysql 1.接口 要继承这个接口,这个接口提供了 ...

随机推荐

  1. duilib 新增数据迁移界面

    xml界面配置: <?xml version="1.0" encoding="utf-8"?> <Window caption="0 ...

  2. map映射

    采集于:https://blog.csdn.net/luanpeng825485697/article/details/78056312 映射map: var map = new Map(); //映 ...

  3. 微信小程序调用高德地图

    index.wxml: longitude:经度 latitude:维度 地图所定位的区域 index.js 地图所定位的点

  4. Python 学习笔记6 变量-字典

    字典是python中一个十分重要的变量,他是一个可变的容器对象.通过一组key(键)和value(值)对组成一个元素. 组成形式为{'key':'value', 'key':'value'}.整个字典 ...

  5. kettle 通用的数据库迁移流程

    需求: 1.你是否遇到了需要将mysql数据库中的所有表与数据迁移到Oracle. 2.你是否还在使用kettle重复的画着:表输入-表输出.创建表,而烦恼. 下面为你实现了一套通用的数据库迁移流程. ...

  6. [vue开发记录]全局loading组件

    上图不上种,菊花万人捅: loading.js: import './loading.css' let Loading = {} // 避免重复install,设立flag Loading.insta ...

  7. centos7开启80和8080端口

    开启8080端口 firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload 重定向80端口到8080端口firewall-c ...

  8. python 面试小基础

    1.  py2和py3的区别? 2.  进程 / 线程 / 协程的区别?

  9. 《图解HTTP》读书笔记(七:通信数据转发程序-代理/网关/隧道)

    HTTP通信时,除客户端和服务器以外,还有一些用于通信数据转发的应用程序,例如代理.网关和隧道,它们可以配合服务器工作.这些服务器和应用程序可以将请求转发给通信线路上的下一站服务器,并且能接收从那台服 ...

  10. Jackson流式API

    public class JacksonTester {   public static void main(String args[]){    JacksonTester tester = new ...