条件查询按时间段查询
来源:互联网 发布:绘图设计软件 编辑:程序博客网 时间:2024/05/21 09:44
controller层中:
//hrs 2015-02-05 新闻条件查询增加时间段查询 start
String startTime = request.getParameter("startTime");String endTime = request.getParameter("endTime");
//end
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
map.put("content", content);
//hrs 2015-02-05 新闻条件查询增加时间段查询start
map.put("startTime", startTime);
map.put("endTime", endTime);
//end
//hrs 2015-02-05 新闻条件查询增加时间段查询start
modelAndView.addObject("startTime", startTime);
modelAndView.addObject("endTime", endTime);
//end
Dao层中:
//hrs 2015-02-05 新闻条件查询增加时间段查询 start
Object startTime = map.get("startTime");
if(startTime!=null&&!startTime.toString().equals("")){
if(wherehql.equals("")){
wherehql+=" where ";
}else{
wherehql += " and ";
}
wherehql += "time >= '" + startTime.toString() + "'";
}
Object endTime = map.get("endTime");
if(endTime!=null&&!endTime.toString().equals("")){
if(wherehql.equals("")){
wherehql+=" where ";
}else{
wherehql += " and ";
}
wherehql += "time <= '" + endTime.toString() + "'";
}
//end
页面:
<!--hsr 2015-02-05 新闻条件查询增加时间段查询功能 start-->
新闻发布时间:<input type = "text" name = "startTime" value = "${startTime}" class = "date" dateFmt="yyyy-MM-dd HH:mm" readonly="true" >
-<input type = "text" name = "endTime" value = "${endTime}" class = "date" dateFmt = "yyyy-MM-dd HH:mm" readonly = "true" >
<!--end -->
- 条件查询按时间段查询
- Oracle 按时间段查询
- oracle按时间段查询
- mysql按时间段查询
- mysql 按时间段查询
- java操作mongdb多条件复合查询(包括模糊查询和按时间段查询),分页
- 按时间段查询MYSQL语句
- MySql 按时间段查询数据方法
- 按时间段查询Mysql语句
- MySql 按时间段查询数据方法
- SQL如何按时间段查询
- MySql 按时间段查询数据方法
- Sybase按时间段查询数据
- MySql 按时间段查询数据方法
- sql server 按时间段查询
- Hibernate hql语句按时间段查询
- Spring Jpa 按时间段查询
- Mysql 按时间段、某一天 查询
- LeetCode101——Symmetric Tree
- Combining Qt Widgets and QML with QWidget::createWindowContainer()
- 网站安全 Spring MVC防御CSRF、XSS和SQL注入攻击
- LinuxC下获取UDP包中的路由目的IP地址和头标识目的地址
- HDU1081
- 条件查询按时间段查询
- hdu 1503 记忆化搜索+递归输出+标记前驱
- 如何在SpringMVC中获取request对象
- cocos2d-x 字体描边CCRenderTexture glBlendFunc
- Intent传递非基本类型的值
- 关于Redis的常识
- LeetCode100——Same Tree
- Smallest Regular Polygon - UVa 12300 几何
- 基于OAUTH的电子商务支付集成研究与实现