Mybatis时间段比较
在开始时间和结束时间内的一段时间范围的查询
<if test="timeStart != null and timeStart != ''">
and wfsj >= to_date(#{timeStart}, 'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="timeEnd != null and timeEnd != ''">
and wfsj < to_date(#{timeEnd}, 'yyyy-MM-dd hh24:mi:ss')
</if>
查询某个月的
传入的就是“2017-02”这种格式的。
<if test="lastMaintenance !=null and lastMaintenance !=''">
and to_char(last_maintenance,'yyyy-mm') = #{lastMaintenance}
</if>
//*************************月份选择*easyui的datebox以月份展示
JSP:
<div class="m-form-cell">
<label for="search-box">维护时间:</label> <input type="text" id="datetime1" >
</div>
JS:
$(function() {
$('#datetime1').datebox({
onShowPanel : function() {// 显示日趋选择对象后再触发弹出月份层的事件,初始化时没有生成月份层
span.trigger('click'); // 触发click事件弹出月份层
if (!tds)
setTimeout(function() {// 延时触发获取月份对象,因为上面的事件触发和对象生成有时间间隔
tds = p.find('div.calendar-menu-month-inner td');
tds.click(function(e) {
e.stopPropagation(); // 禁止冒泡执行easyui给月份绑定的事件
var year = /\d{4}/.exec(span.html())[0]// 得到年份
, month = parseInt($(this).attr('abbr'), 10) + 1; // 月份
$('#datetime1').datebox('hidePanel')// 隐藏日期对象
.datebox('setValue', year + '-' + month); // 设置日期的值
});
}, 0);
},
parser : function(s) {// 配置parser,返回选择的日期
if (!s)
return new Date();
var arr = s.split('-');
return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, 1);
},
formatter : function(d) {
var month = d.getMonth();
if(month<=10){
month = "0"+month;
}
if (d.getMonth() == 0) {
return d.getFullYear()-1 + '-' + 12;
} else {
return d.getFullYear() + '-' + month;
}
}// 配置formatter,只返回年月
});
var p = $('#datetime1').datebox('panel'), // 日期选择对象
tds = false, // 日期选择对象中月份
span = p.find('span.calendar-text'); // 显示月份层的触发控件
});
Mybatis时间段比较的更多相关文章
- mybatis写当天 当月的数据 时间段数据
1 数据库字段pk_time(Varchar) 当天的数据 SELECT * FROM 表 WHERE date(fk_time) = curdate(); 当月的数据 SELECT *FROM 表 ...
- mybatis写当天 当月的数据 时间段数据https://www.cnblogs.com/xzjf/p/7600533.html
mybatis写当天 当月的数据 时间段数据----https://www.cnblogs.com/xzjf/p/7600533.html
- MyBatis 3实现时间段精确的查询(转)
效果如下: 说明: 时间范围的查询会存在以下问题: 1.如果单纯采用年月日的形式会出现缺少最后一点的数据,比如要查询2015-09-16到2015-09-17,那么2015-09-17 01:00:0 ...
- mybatis查询时间段sql语句
转载自:http://blog.csdn.net/zl544434558/article/details/24428307?utm_source=tuicool&utm_medium=refe ...
- MySQL、mybatis的查询条件-时间段
1.配置文件中的写法 <if test="startTime !=null and startTime !='' "> <![CDATA[ and createT ...
- Mybatis中如何查询时间段内的数据
最后一个是正确的,前边的三个是可能遇到的坑,给大家展示一下,如果不需要的,可以直接跳到最后看: 有时候我们需要查询一张表内一段时间内操作的数据,大家很容易就想到了 between ? and ? 这个 ...
- mybatis查询时间段
参考:https://bbs.csdn.net/topics/391838987 <!-- 查询条件:创建开始时间 --> <if test="createdBeginti ...
- Mybatis中xml文件的时间段动态查询
- MySQL Fabric和MyBatis的整合过程中遇到的问题
这是我昨天在整合MySQL Fabric和MyBatis时遇到的问题,花了大半天才解决的问题,解决的过程中在网上查找了很久,都没有找到解决的方案.现在记下来,希望能够帮助有同样问题的朋友.如果各位朋友 ...
随机推荐
- [No0000C2]WPF 数据绑定的调试
)DataBinding的表达式无效时,跟踪Debug的输出信息来查找原因(2)DataBinding的表达式有效,但是数据和期望值不同,此时可以在Converter中断点调试 :在VS输出窗口跟踪信 ...
- Spring <context:annotation-config> 与<context-component-scan> 的作用
<context:annotation-config> 与<context-component-scan> 的作用 <context:annotation-config& ...
- Etcd+Confd实现Nginx配置文件自动管理
一.需求 我们使用Nginx做七层负载均衡,后端是Tomcat.项目采用灰度发布方式,每次项目升级,都要手动先从Nginx下摘掉一组,然后再升级这组,当项目快速迭代时,手动做这些操作显然会增加部署时间 ...
- Only the storage referenced by ptr is modified. No other storage locations are accessed by the call.
free - C++ Reference http://www.cplusplus.com/reference/cstdlib/free/ Data races Only the storage re ...
- A pointer is a variable whose value is the address of another variable 指针 null pointer 空指针 内存地址0 空指针检验
小结: 1.指针的实际值为代表内存地址的16进制数: 2.不同指针的区别是他们指向的变量.常量的类型: https://www.tutorialspoint.com/cprogramming/c_po ...
- PHP进阶-浏览器到PHP发展历史
从浏览器到PHP发展历史 php-cgi实现cgi的解析器,每个fork过程都开启一个进程,并会进行一个关闭进程的操作. 长注内存解释器(一个进程) fastcgi 多进程共享一个端口是一个问题,多进 ...
- [development][thrift] RPC框架 thrift
一: wiki:https://zh.wikipedia.org/wiki/Thrift 二: 来自IBM的介绍:https://www.ibm.com/developerworks/cn/java/ ...
- 彻底卸载tv
1.卸载 2.C:\Program Files (x86),找到teamviewer选项,右击删除 3.开始--输入regedit,打开注册表,找到如下路径:HKEY_LOCAL_MACHINE\SO ...
- activeMQ配置文件
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agree ...
- linux 源码安装 mono
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2- ...