mybatis按时间条件搜索
dto接受前台字符串时间格式
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date contractStartDt;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date contractEndDt;
dto部分
private Date proCreateDt;
private Date proCompleteDt;
private String proCreateDtStr;
private String proCompleteDtStr;
mybatis mapper.xml部分
<if test="entity.proName != null and entity.proName !=''">,
<![CDATA[ AND pro_name = #{entity.proName} ]]>
</if>
<if test="entity.proCreateDtStr != null and entity.proCreateDtStr !=''">
<![CDATA[ AND pro_create_dt Like CONCAT('${entity.proCreateDtStr}','%' )]]>
</if>
<if test="entity.proCompleteDtStr != null and entity.proCompleteDtStr !=''">
<![CDATA[ AND pro_complete_dt Like CONCAT('${entity.proCompleteDtStr}','%' )]]>
</if>
<if test="entity.contractStartDtStr != null and entity.contractStartDtStr != ''">
<![CDATA[ and contract_start_dt >= #{entity.contractStartDtStr,jdbcType=VARCHAR}]]>
</if>
<if test="entity.contractEndDtStr != null and entity.contractEndDtStr != ''">
<![CDATA[ and DATE_FORMAT(contract_end_dt, '%Y-%m-%d') <= #{entity.contractEndDtStr,jdbcType=VARCHAR}]]>
</if>
<if test="entity.ownIds != null and entity.ownIds.size > 0">
<![CDATA[ and contract_own_id in]]>
<foreach collection="entity.ownIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="entity.supplierIds != null and entity.supplierIds.size > 0">
<![CDATA[ and contract_supplier_id in]]>
<foreach collection="entity.supplierIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
mybatis按时间条件搜索的更多相关文章
- mybatis按datetime条件查询,参数为时间戳时
mybatis按datetime条件查询,参数为时间戳时,如果数据库为2018-1-1 20:22:10, 你的时间戳也为2018-1-1 20:22:10,但却没找到数据.可能是时差导致的.百度修正 ...
- 测试开发【提测平台】分享12-掌握日期组件&列表状态格式化最终实现提测管理多条件搜索展示功能
微信搜索[大奇测试开],关注这个坚持分享测试开发干货的家伙. 本章内容思维导图如下,由于需要各种状态下的菜单操作,所以需要先实现提测信息的列表基础页面,然后再推进其他需求开发 基本知识点学习 Date ...
- Node.js、express、mongodb 实现分页查询、条件搜索
前言 在上一篇Node.js.express.mongodb 入门(基于easyui datagrid增删改查) 的基础上实现了分页查询.带条件搜索. 实现效果 1.列表第一页. 2.列表第二页 3. ...
- php多条件搜索
PHP多条件查询 December : Tuesdayby 小屋 在我们的网站设计过程中,经常会用到多条件查询,本文的源码是一个二手房屋查询的例子.在本例中,我们要实现能够通过地理位置,物业类型,房屋 ...
- 对于唯一索引使用唯一条件搜索, InnoDB 只锁定找到的index record,不是它之前的区间
| test100 | CREATE TABLE `test100` ( `sn` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增编号', `phoneNo` ...
- Lucene第二篇【抽取工具类、索引库优化、分词器、高亮、摘要、排序、多条件搜索】
对Lucene代码优化 我们再次看回我们上一篇快速入门写过的代码,我来截取一些有代表性的: 以下代码在把数据填充到索引库,和从索引库查询数据的时候,都出现了.是重复代码! Directory dire ...
- PHPlaravel中从数据库中选择数据是增加时间条件及各种条件
注:附加条件后要加get函数. 1.public function getForDataTable($startTime,$endTime){ return $this->query() -&g ...
- Linux C:access()时间条件竞争漏洞
access()函数用来检查调用进程是否可以对指定的文件执行某种操作. ================================================================ ...
- 多条件搜索问题 -sql拼接与参数化查询
来源:传智播客 免费开发视频. 问题:根据书名或出版社或作者查询书籍信息. using System; using System.Collections.Generic问题; using Syste ...
随机推荐
- 【Python全栈笔记】03 [模块二] 16-17 Oct Set 集合,三目运算
Set 集合 set - unordered collections of unique elements 创建一个set/一个空set # create a new set set1 = {1,2, ...
- Camstar Portal modeling user guid --自定义用户菜单
通过studio 创建 menu definition 创建菜单 创建成功后到employee界面设置对应菜单就可以了
- 通过RGB灯输出七色
本文由博主原创,如有不对之处请指明,转载请说明出处. /********************************* 代码功能:输出模拟信号,控制RGB灯的颜色 使用函数: pinMode(引脚 ...
- 二叉树基本操作C++
#include <cstdio> #include <climits> #include <cassert> #include <iostream> ...
- Entity Framework Code First数据库自动更新
EF的Code First方式允许你先写Model,再通过Model生成数据库和表. 具体步骤如下: 1.建项目 2.在model文件夹中,添加一个派生自DbContext的类,和一些Model类. ...
- 使用spring-data-redis做缓存
说到缓存,首先肯定是spring-cache了. spring-cache使用一个CacheManager来进行管理缓存,为了使用我们的redis作为缓存源,需要向spring注册一个CacheMan ...
- Architecture.the-reactive-manifesto
The Reactive Manifesto (Chinese Edition) Reference 1. The Reactive Manifesto http://www.reactivemani ...
- Daily Scrum 12.14
今日完成任务: 优化了问题页面显示问题的算法:两名开发人员有CCF考试,今天没有完成任务,任务顺延到明天. 明日任务: 黎柱金 解决资源显示全部为同一个PDF的BUG 晏旭瑞 资源搜索问题 孙思权 做 ...
- 常用邮件服务器名(POP3,SMTP地址)
POP3服务器地址:pop3.sina.com.cn(端口:110)SMTP服务器地址:smtp.sina.com.cn(端口:25) sina.cn: POP3服务器地址:pop3.sina.com ...
- ESM335x Linux输出脉冲计数
1.综述 ESM335X具有4路PWM输出,其中PWM1和PWM2除了可以用于产生标准的PWM信号,现已支持输出脉冲计数功能,可以在应用程序中设置脉冲个 数,当输出脉冲个数达到指定值时,驱动程序自 ...