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. SQL - 1.区分login、user、schema和role

        Login Login 是Server一级的概念,表示登录Server的凭证,比如在Server_A上有一个数据库DA,那么想要访问数据库DA,第一步要做的事情就是先登录到Hosting该数据 ...

  2. Codeforces Round #542 题解

    Codeforces Round #542 abstract I决策中的独立性, II联通块染色板子 IIIVoronoi diagram O(N^2 logN) VI环上距离分类讨论加取模,最值中的 ...

  3. 记录智能合约solidity编译的坑

    在Linux环境下入门写一段solidity编译遇到error和warning,经过一番研究后才得其缘由,下面以一段demo总结一下. pragma solidity ^; // 指定所需的编译器版本 ...

  4. mac下git安装与使用

    1.下载git客户端,下载地址为:https://git-scm.com/download/mac 2.打开安装包,可以看到此时的界面为:   我们需要把.pkg的安装包安装到系统当中.我双击了安装包 ...

  5. yum解决 "Couldn't resolve host 'apt.sw.be'" 错误

    1.yum无法安装工具    failure: repodata/repomd.xml from dag: [Errno 256] No more mirrors to try.http://apt. ...

  6. redis 3.2 新数据结构:quicklist、String的embstr与raw编码方式分界点

    Redis3.2.0引入了新的quicklist的数据结构做了list的底层存储方案.废弃了原来的两个配置参数, list-max-ziplist-entries list-max-ziplist-v ...

  7. 解决nohup中不写入日志的问题

    (一)问题描述: nohup 你的程序命令 如: nohup python manage.py runserver 0.0.0.0:6789   (此shell窗口1不要关,另外开一个shell窗口2 ...

  8. principal(括号匹配+多组查询)

    题目传送门: 把所有括号相匹配的段直接预处理出来就行了 #include <bits/stdc++.h> using namespace std; #define ll long long ...

  9. Docker容器中安装vim

    我在docker中安装了jexus.使用vim编辑default配置文件的时候提示 vim: command not found 原因是docker中没有安装vim命令 如果你直接输入  apt-ge ...

  10. PeopleSoft translate value 排序

    这个function 可以对record.field 的dropdownlist 排序,也可以把描述前边加个数字.但是有时候用户不接受.所以调用这个方法是比较好的选择. Function Order_ ...