zoukankan      html  css  js  c++  java
  • Properties条件查询(适用于StorageAPI操作数据库)

     1    //查询时间
     2             Properties p = new Properties();
     3             if (createtime1 != null && !createtime1.equals("") && createtime2 != null && !createtime2.equals("")) {
     4                 long stime = Util.dateFormat(createtime1, "yyyy-MM-dd HH:mm");
     5                 long etime = Util.dateFormat(createtime2, "yyyy-MM-dd HH:mm");
     6                 props.setProperty("createtime", "<between>" + stime + " and " + etime);
     7             }else if (createtime1 != null && !createtime1.equals("")) {
     8                 long stime = Util.dateFormat(createtime1, "yyyy-MM-dd HH:mm");
     9                 long etime = System.currentTimeMillis();
    10                 props.setProperty("createtime", "<between>" + stime + " and "+"");  //  >= 条件
    11             }else if (createtime2 != null && !createtime2.equals("")) {
    12                 long stime = Util.dateFormat("1970-01-01 00:00", "yyyy-MM-dd HH:mm");
    13                 long etime = Util.dateFormat(createtime2, "yyyy-MM-dd HH:mm");
    14                 props.setProperty("createtime", "<between>" +"" + " and " + etime);   // <=  
    15 
    16           //模糊查询
    17           Properties p = new Properties();
    18           if (ip != null && !ip.isEmpty()){
    19               p.put("name", "*" + ip + "*");
    20           }
    21           if (neName != null && !neName.isEmpty()){
    22               p.put("displayName", "*" + neName + "*");    //占位符“*”可以模糊查询
    23           }
    24            p.put("code", "!" + code); // 占位符“!”相当于!= 查找不等于code的值
    25              
  • 相关阅读:
    Stl源码剖析读书笔记之Alloc细节
    Lua热更系统
    Linux C++线程池
    linux sort,uniq,cut,wc.
    (转)Linux grep
    用LogParser分析IIS请求压力
    (转)MySQL主从复制的常见拓扑、原理分析以及如何提高主从复制的效率总
    AIS相关资料
    python学习笔记
    (转)MySQL InnoDB修复笔记
  • 原文地址:https://www.cnblogs.com/lhq1996/p/11578369.html
Copyright © 2011-2022 走看看