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