在开始时间和结束时间内的一段时间范围的查询

<if test="timeStart != null and timeStart != ''">
and wfsj &gt;= to_date(#{timeStart}, 'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="timeEnd != null and timeEnd != ''">
and wfsj &lt; 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时间段比较的更多相关文章

  1. mybatis写当天 当月的数据 时间段数据

    1 数据库字段pk_time(Varchar) 当天的数据 SELECT * FROM 表 WHERE date(fk_time) = curdate(); 当月的数据 SELECT *FROM 表 ...

  2. mybatis写当天 当月的数据 时间段数据https://www.cnblogs.com/xzjf/p/7600533.html

    mybatis写当天 当月的数据 时间段数据----https://www.cnblogs.com/xzjf/p/7600533.html

  3. MyBatis 3实现时间段精确的查询(转)

    效果如下: 说明: 时间范围的查询会存在以下问题: 1.如果单纯采用年月日的形式会出现缺少最后一点的数据,比如要查询2015-09-16到2015-09-17,那么2015-09-17 01:00:0 ...

  4. mybatis查询时间段sql语句

    转载自:http://blog.csdn.net/zl544434558/article/details/24428307?utm_source=tuicool&utm_medium=refe ...

  5. MySQL、mybatis的查询条件-时间段

    1.配置文件中的写法 <if test="startTime !=null and startTime !='' "> <![CDATA[ and createT ...

  6. Mybatis中如何查询时间段内的数据

    最后一个是正确的,前边的三个是可能遇到的坑,给大家展示一下,如果不需要的,可以直接跳到最后看: 有时候我们需要查询一张表内一段时间内操作的数据,大家很容易就想到了 between ? and ? 这个 ...

  7. mybatis查询时间段

    参考:https://bbs.csdn.net/topics/391838987 <!-- 查询条件:创建开始时间 --> <if test="createdBeginti ...

  8. Mybatis中xml文件的时间段动态查询

  9. MySQL Fabric和MyBatis的整合过程中遇到的问题

    这是我昨天在整合MySQL Fabric和MyBatis时遇到的问题,花了大半天才解决的问题,解决的过程中在网上查找了很久,都没有找到解决的方案.现在记下来,希望能够帮助有同样问题的朋友.如果各位朋友 ...

随机推荐

  1. [No0000112]ComputerInfo,C#获取计算机信息(cpu使用率,内存占用率,硬盘,网络信息)

    github地址:https://github.com/charygao/SmsComputerMonitor 软件用于实时监控当前系统资源等情况,并调用接口,当资源被超额占用时,发送警报到个人手机: ...

  2. [No0000E6]C# 判断与循环

    判断语句 语句 描述 if 语句 一个 if 语句 由一个布尔表达式后跟一个或多个语句组成. if...else 语句 一个 if 语句 后可跟一个可选的 else 语句,else 语句在布尔表达式为 ...

  3. Vue 超快速学习

    Vue 超快速学习 基础知识: 1.vue的生命周期: beforeCreate/created. beforeMount/mounted. beforeUpdate/updated. beforeD ...

  4. C和C指针小记(十二)-函数的可变参数表

    1.可变参数表是通过宏实现的 宏定义于stdarg.h头文件,它是标准库的一部分.这个头文件声明了一个类型var_list和三个宏--va_start.va_arg.va_end. 我们可以声明一个类 ...

  5. [others]tinycore/microcore

    https://zh.wikipedia.org/wiki/Tiny_Core_Linux https://github.com/zeit/micro

  6. [archlinux][daily] 自建DNS服务器 / 建立本地DNS cache / 使用dnsmasq加速上网

    新公司,上网超慢,DNS竟然是远程地址,终于找到机会学习一下dnsmasq了. update@20170516: 上网慢是因为分给我的IP有限流策略,其实远端DNS并不会造成感受上的上网慢. 参考:h ...

  7. mysql学习【第1篇】:初识MySQL

    狂神声明 : 文章均为自己的学习笔记 , 转载一定注明出处 ; 编辑不易 , 防君子不防小人~共勉 ! mysql学习[第1篇]:初识MySQL 只会写代码的是码农:学好数据库,基本能混口饭吃:在此基 ...

  8. 过滤器会拦截 前端页面加载 js文件的请求

    学艺不精啊.....之前就总结过博客: JAVA中解决Filter过滤掉css,js,图片文件等问题 结果现在又犯了老错误~ 情况如下: index.jsp 页面的验证码输入栏绑定了异步验证(jQur ...

  9. python学习目录(转载)

    python基础篇 python 基础知识    python 初始python    python 字符编码    python 类型及变量    python 字符串详解 python 列表详解 ...

  10. LeetCode 258 Add Digits 解题报告

    题目要求 Given a non-negative integer num, repeatedly add all its digits until the result has only one d ...