Mybatis和Mybatis-Plus时间范围查询,亲测有效
一、mysql
1.传入时间范围参数类型是字符串
<if test="startTime!=null and startTime.trim() neq ''">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') >= str_to_date(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime!=null and endTime.trim() neq ''">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') <= str_to_date(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
2.传入时间范围参数类型是Date
<if test="startTime!=null and startTime.trim() neq ''">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime!=null and endTime.trim() neq ''">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
3.Mybatis-Plus时间范围查询
Page<Record> page = new Page<>(page, limit);
IPage<Record> result = iRecordService.page(page,
new LambdaQueryWrapper<Record>()
.apply(StrUtil.isNotBlank(start_date),
"date_format (optime,'%Y-%m-%d') >= date_format('" + start_date + "','%Y-%m-%d')")
.apply(StrUtil.isNotBlank(end_date),
"date_format (optime,'%Y-%m-%d') <= date_format('" + end_date + "','%Y-%m-%d')")
.orderByDesc(HmsFaceDetectLog::getOptime));
Mybatis和Mybatis-Plus时间范围查询,亲测有效的更多相关文章
- Mybatis时间范围查询,亲测有效
Md2All export document .output_wrapper pre code{font-family: Consolas, Inconsolata, Courier, monospa ...
- idea插件(mybatis框架下mapper接口快速跳转对应xml文件)亲测好用!
我相信目前在绝大部分公司里,主要使用的框架是S(spring)S(spring MVC)M(mybatis),其中mybatis总体架构是编写mapper接口,框架扫描其对应的mapper.xml文件 ...
- mybatis自动生成代码插件mybatis-generator使用流程(亲测可用)
mybatis-generator是一款在使用mybatis框架时,自动生成model,dao和mapper的工具,很大程度上减少了业务开发人员的手动编码时间 坐着在idea上用maven构建spri ...
- IDEA 使用Mybatis效率飞起来的必备工具:MybatisCodeHelperPro 最新破解版,亲测可用!
IDEA 2018.3.5 最新版本亲测可用. Git地址:https://github.com/pengzhile/MyBatisCodeHelper-Pro-Crack/releases 下载最新 ...
- Mybatis oracle多表联合查询分页数据重复的问题
Mybatis oracle多表联合查询分页数据重复的问题 多表联合查询分页获取数据时出现一个诡异的现象:数据总条数正确,但有些记录多了,有些记录却又少了甚至没了.针对这个问题找了好久,最后发现是由于 ...
- MyBatis:学习笔记(3)——关联查询
MyBatis:学习笔记(3)--关联查询 关联查询 理解联结 SQL最强大的功能之一在于我们可以在数据查询的执行中可以使用联结,来将多个表中的数据作为整体进行筛选. 模拟一个简单的在线商品购物系统, ...
- 【Mybatis】【3】mybatis Example Criteria like 模糊查询
正文: 在Java中使用Mybatis自动生成的方法,like需要自己写通配符 public List<TableA> query(String name) { Example examp ...
- Mybatis使用MySQL进行模糊查询时输入中文检索不到结果
Mybatis使用MySQL进行模糊查询时输入中文检索时,需要在jdbcURL后增加参数 ?useUnicode=true&characterEncoding=UTF-8
- 【Mybatis】MyBatis之表的关联查询(五)
本章介绍Mybatis之表的关联查询 一对一关联 查询员工信息以及员工的部门信息 1.准备表employee员工表,department部门表 CREATE TABLE `employee` ( `i ...
随机推荐
- requests模块使用
一.python环境下安装requests Windows下使用win+r打开cmd命令提示符,输入pip install requests,回车. 二.requests模块导入 import req ...
- jmeter性能测试入门使用参数化
我经常使用jmeter进行接口测试,这个工具还是很好用的.昨天收到一个需求,需要压测一下接口,jmeter进行接口测试,使用cvs文件进行多个数据参数化. 临时准备了一下发现忘记怎么做参数化了,自己百 ...
- Python版常见的排序算法
学习笔记 排序算法 目录 学习笔记 排序算法 1.冒泡排序 2.选择排序 3.插入排序 4.希尔排序 5.快速排序 6.归并排序 7.堆排序 排序分为两类,比较类排序和非比较类排序,比较类排序通过比较 ...
- Jmeter系列(49)- 详解 HTTP Cookie 管理器
如果你想从头学习Jmeter,可以看看这个系列的文章哦 https://www.cnblogs.com/poloyy/category/1746599.html 简单介绍 功能一 首先,它像网络浏览器 ...
- VScode+PicGo+Github+jsdelivr使用图床书写Markdown
本文讲述使用Github作为图床,VScode搭配Picgo插件书写Markdown,并使用jsdelivr进行CDN加速的配置流程. 准备阶段 首先进行以下准备工作,都很简单,不再赘述. 注册Git ...
- Linux环境安装Docker入门教程
安装 下载 wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.1-ce.tgz 解压 tar -xvf ...
- Mybatis入门(四)------联表查询
Mybatis联表查询 一.1对1查询 1.数据库建表 假设一个老师带一个学生 CREATE TABLE teacher( t_id INT PRIMARY KEY, t_name VARCHAR(3 ...
- python3 raw 数据转换为jpg
python3 raw 数据转换为jpg 我们大家都知道,sensor 直接出来的裸数据为raw 数据,没有经过编解码,压缩. 我们需要将raw数据转换为其他格式比如jpg,png,bmp 人眼才能看 ...
- latex在线帮助文档
1.ctex官方网站 http://www.ctex.org/HomePage 2.在线帮助文档 http://www.ctex.org/OnlineDocuments
- python 报错错误集合——更新中
1. #!/usr/bin/env python # -*- coding:utf-8 -*- 'one #报错 File "C:\Users\shuxiu\Desktop\test.py& ...