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

<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. 多线程 ForkJoinPool

    阅读目录 使用 背景:ForkJoinPool的优势在于,可以充分利用多cpu,多核cpu的优势,把一个任务拆分成多个“小任务”,把多个“小任务”放到多个处理器核心上并行执行:当多个“小任务”执行完成 ...

  2. C语言中点操作符(.)和箭头操作符(->)

    C语言中点操作符(.)和箭头操作符(->) 点说语法不太准确,许多都称该之为点运算符/操作符,箭头运算符/操作符.但是OC中叫点语法,感觉理解起来还蛮舒服.毕竟基础的C操作符中是 相同点 两个都 ...

  3. xcode工程编译错误:"An instance 0xca90200 of class UITableView was deallocated while key value observers were still registered with it"

    An instance 0xca90200 of class UITableView was deallocated while key value observers were still regi ...

  4. iOS 修改TabBar的item间距

    @interface HPTabBarController ()<UITabBarControllerDelegate>//继承自UITabBarController @property ...

  5. PLSQL游标

    静态游标:结果集已经确实(静态定义)的游标.分为隐式和显式游标 隐式游标:所有DML语句为隐式游标,通过隐式游标属性可以获取SQL语句信息: 显式游标:用户显式声明的游标,即指定结果集.当查询返回结果 ...

  6. RN NetInfo使用

    代码: class NetInfoView extends Component { getNetInfo() { //如果是andorid的程序,需要在xml添加获取网络请求权限 NetInfo.fe ...

  7. 遍历map并判断key的值

    jsp页面:三种方法输出 <c:forEach items="${myMap}" var="mapV" varStatus="status&qu ...

  8. function module 调用类对象

    1: 定义一个类,编辑里面的方法 method METHOD1. write EV_P2. ev_p1 = 'test'. endmethod. 2:在其它function module 中调用

  9. Django 框架 django的请求生命周期

    概述 首先我们知道HTTP请求及服务端响应中传输的所有数据都是字符串,同时http请求是无状态的,可以通过session和cookie来辅助. 浏览器通过ip和端口及路由方式访问服务端. 在Djang ...

  10. Windows 下MySql Replication(复制)配置

    环境准备 到官网下载mysql-installer-web-community-5.7.21.0.msi并安装,选择MySql Workbench,记录安装时root输入的密码. 需要安装在两台机器上 ...