一、mysql

1.传入时间范围参数类型是字符串

 <if test="startTime!=null and startTime.trim() neq ''">
and date_format(create_time,'%Y-%m-%d %H:%i:%s') &gt;= 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') &lt;= 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') &gt;= 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') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>

3.Mybatis-Plus时间范围查询

 Page<HmsFaceDetectLog> page = initPage();
IPage<HmsFaceDetectLog> result = iHmsFaceDetectLogService.page(page,
new LambdaQueryWrapper<HmsFaceDetectLog>()
.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时间范围查询,亲测有效的更多相关文章

  1. mybatis时间范围查询

    <if test="excStartTime!=null and excStartTime!=''"> <![CDATA[ and DATE_FORMAT(dl. ...

  2. Mybatis和Mybatis-Plus时间范围查询,亲测有效

    一.mysql 1.传入时间范围参数类型是字符串 <if test="startTime!=null and startTime.trim() neq ''"> and ...

  3. idea插件(mybatis框架下mapper接口快速跳转对应xml文件)亲测好用!

    我相信目前在绝大部分公司里,主要使用的框架是S(spring)S(spring MVC)M(mybatis),其中mybatis总体架构是编写mapper接口,框架扫描其对应的mapper.xml文件 ...

  4. mybatis自动生成代码插件mybatis-generator使用流程(亲测可用)

    mybatis-generator是一款在使用mybatis框架时,自动生成model,dao和mapper的工具,很大程度上减少了业务开发人员的手动编码时间 坐着在idea上用maven构建spri ...

  5. IDEA 使用Mybatis效率飞起来的必备工具:MybatisCodeHelperPro 最新破解版,亲测可用!

    IDEA 2018.3.5 最新版本亲测可用. Git地址:https://github.com/pengzhile/MyBatisCodeHelper-Pro-Crack/releases 下载最新 ...

  6. 【亲测】解决虚拟机CentOS7联网ping不通相关问题(通俗易懂)

    对于是使用windows操作系统的小伙伴来说(mac用户忽略),要学习一些技术可能需要使用Linux系统,自然就需要使用虚拟机安装Linux,当然现在很多主流的学习网站上的教程都会提供老师配置好的虚拟 ...

  7. CSS响应式:根据分辨率加载不同CSS的几个方法,亲测可用

    有时候你需要把同一个页面在手机和pc同时打开,其中有一个办法就是判断不同分辨路加载不同的css 小编总结了几种分别加载css的方法: 1.比较复杂的使用js判断加载不同css (亲测可用) 但是这种方 ...

  8. [专业亲测]Ubuntu16.04安装Nvidia显卡驱动(cuda)--解决你的所有困惑【转】

    本文转载自: 因为要做毕设需要安装caffe2,配置cuda8.0,但是安装nvidia驱动真的是把我难倒了,看了很多篇博文都没有效果,现在我自己重新总结了下几种 安装方法(亲测有效),希望能帮到大家 ...

  9. 爬虫之手机APP抓包教程-亲测HTTP和HTTPS均可实现

    当下很多网站都有做自己的APP端产品,一个优秀的爬虫工程师,必须能够绕过难爬取点而取捷径,这是皆大欢喜的.但是在网上收罗和查阅了无数文档和资料,本人亲测无数次,均不能正常获取HTTPS数据,究其原因是 ...

随机推荐

  1. json文件操作

    1.把字典或list转换成字符串方法 json.dumps() 2.把字符串转换成字典方法 json.loads() 3.indent 存储文件时每行加缩进数 4.ensere_asci 文件中有中文 ...

  2. vue中axios的安装使用

    axios是一个基于 promise 的 HTTP 库,在vue中axios是比较常用的网络请求方法. 安装 npm install axios -S 在main.js配置 import axios ...

  3. Highcharts图表库

    Highcharts图表库 1.相关网址: 1)官方主页:https://www.hcharts.cn/ 2)Highcharts演示:https://www.hcharts.cn/demo/high ...

  4. cgdb使用方法

    cgdb --args [exe_name] [arg1] [arg2] [arg3] [...] 进入代码窗口 按ESC键 进入调试窗口 按i键 调试命令 r 运行 n 单步执行(不进入函数) s ...

  5. Netty服务端接收的新连接是如何绑定到worker线程池的?

    更多技术分享可关注我 前言 原文:Netty服务端接收的新连接是如何绑定到worker线程池的? 前面分析Netty服务端检测新连接的过程提到了NioServerSocketChannel读完新连接后 ...

  6. PAS

    一.概念 二.安装 打开Delphi,在主菜单上选择Component,单击Install Component,出现图所示的对话框.有两个选择,装到已经存在的包里面和装到新的包里面.我们选择后者,单击 ...

  7. asp.net core webapi Session 跨域

    在ajax 请求是也要加相应的东西 $.ajax({ url:url, //加上这句话 xhrFields: { withCredentials: true } success:function(re ...

  8. python 中自带的堆模块heapq

    import heapq my_heap = [] #使用列表保存数据 #网列表中插入数据,优先级使用插入的内容来表示,就是一个比较大小的操作,越大优先级越高 heapq.heappush(my_he ...

  9. python爬虫实战之爬取智联职位信息和博客文章信息

    1.python爬取招聘信息 简单爬取智联招聘职位信息 # !/usr/bin/env python # -*-coding:utf-8-*- """ @Author  ...

  10. 使用 GoLand 启动 运行 Go 项目

    来源:https://my.oschina.net/u/3744526/blog/3085468 在使用本博客经验之前 需配置好 GOPATH 跟 GOROOT 创建好本地工作路径之后,使用 GoLa ...