HQL 查询数据 (获取页面输入的查询条件字段)
2013-08-22 14:05
483 查看
/*
* 查询提取位置表所有数据
*
*/
public String ListEtlExtractPositionOfAll(){
// 接受数据库中传送的code
int code = Integer.parseInt(get("code").toString().trim());
this.getmenu(code, this.getRequest());
StringBuffer where = new StringBuffer("1=1");
StringBuffer path = new StringBuffer("ListEtlExtractPositionOfAll.action?code=").append(code);
String wzxx = get("wzxx")==null?"":get("wzxx").toString().trim();
String bbh = get("bbh")==null?"":get("bbh").toString().trim();
if(get("wzxx")!=null && !"".equals(get("wzxx"))){
where.append(" and positionNum like '%").append(wzxx).append("%' ");
path.append(" &wzxx=").append(wzxx);
}
if(get("bbh")!=null && !"".equals(get("bbh"))){
if(get("wzxx")!=null && !"".equals(get("wzxx"))){
where.append(" and versionNum=").append(bbh);
path.append(" &bbh=").append(bbh);
}else{
where.append(" and versionNum=").append(bbh);
path.append(" &bbh=").append(bbh);
}
}
// h获取页面输入的查询条件字段
// String str ="";
// if(get("wzxx")!=null && !"".equals(get("wzxx"))){
// str = " positionNum like '%"+get("wzxx")+"%'";
// }
// if(get("bbh")!=null && !"".equals(get("bbh"))){
// if (get("wzxx")!=null && !"".equals(get("wzxx"))) {
// str += " and versionNum= '"+get("bbh")+"'";
// }else {
// str = " versionNum= '"+get("bbh")+"'";
// }
// }
// 从字典表里把 状态 (60) 取出来
List<SysDictionary> ztDicList = this.orgConfigService.QueryDicByType(60);
if (ztDicList != null) {
this.getRequest().setAttribute("ztDicList", ztDicList);
}
// 查询分页调用ACTION
pageService.getPage(path.toString(), 0, this.getRequest());
// PageEntity entity = pageService.doList("Etlextractposition", "1=1");
PageEntity entity = pageService.doList("Etlextractposition", where.toString().trim());
// PageEntity entity = pageService.doList("Etlextractposition", where.toString().trim()==""?"1=1":where.toString().trim());
// 查询元素表 显示元素信息
List<Baseelement> list = new ArrayList<Baseelement>();
list = bscs.QueryAllBaseelement();
// 设置setAttribute 属性
this.getRequest().setAttribute("list", list);
this.getRequest().setAttribute("page", entity);
this.getRequest().setAttribute("code", code);
this.getRequest().setAttribute("wzxx", get("wzxx"));
this.getRequest().setAttribute("bbh", get("bbh"));
return "success";
}
* 查询提取位置表所有数据
*
*/
public String ListEtlExtractPositionOfAll(){
// 接受数据库中传送的code
int code = Integer.parseInt(get("code").toString().trim());
this.getmenu(code, this.getRequest());
StringBuffer where = new StringBuffer("1=1");
StringBuffer path = new StringBuffer("ListEtlExtractPositionOfAll.action?code=").append(code);
String wzxx = get("wzxx")==null?"":get("wzxx").toString().trim();
String bbh = get("bbh")==null?"":get("bbh").toString().trim();
if(get("wzxx")!=null && !"".equals(get("wzxx"))){
where.append(" and positionNum like '%").append(wzxx).append("%' ");
path.append(" &wzxx=").append(wzxx);
}
if(get("bbh")!=null && !"".equals(get("bbh"))){
if(get("wzxx")!=null && !"".equals(get("wzxx"))){
where.append(" and versionNum=").append(bbh);
path.append(" &bbh=").append(bbh);
}else{
where.append(" and versionNum=").append(bbh);
path.append(" &bbh=").append(bbh);
}
}
// h获取页面输入的查询条件字段
// String str ="";
// if(get("wzxx")!=null && !"".equals(get("wzxx"))){
// str = " positionNum like '%"+get("wzxx")+"%'";
// }
// if(get("bbh")!=null && !"".equals(get("bbh"))){
// if (get("wzxx")!=null && !"".equals(get("wzxx"))) {
// str += " and versionNum= '"+get("bbh")+"'";
// }else {
// str = " versionNum= '"+get("bbh")+"'";
// }
// }
// 从字典表里把 状态 (60) 取出来
List<SysDictionary> ztDicList = this.orgConfigService.QueryDicByType(60);
if (ztDicList != null) {
this.getRequest().setAttribute("ztDicList", ztDicList);
}
// 查询分页调用ACTION
pageService.getPage(path.toString(), 0, this.getRequest());
// PageEntity entity = pageService.doList("Etlextractposition", "1=1");
PageEntity entity = pageService.doList("Etlextractposition", where.toString().trim());
// PageEntity entity = pageService.doList("Etlextractposition", where.toString().trim()==""?"1=1":where.toString().trim());
// 查询元素表 显示元素信息
List<Baseelement> list = new ArrayList<Baseelement>();
list = bscs.QueryAllBaseelement();
// 设置setAttribute 属性
this.getRequest().setAttribute("list", list);
this.getRequest().setAttribute("page", entity);
this.getRequest().setAttribute("code", code);
this.getRequest().setAttribute("wzxx", get("wzxx"));
this.getRequest().setAttribute("bbh", get("bbh"));
return "success";
}
相关文章推荐
- 商城项目练习的注意点(数据的获取,hql查询 ,离线查询,分类判断,下拉列表框选中,隐藏字段传递数据等)
- HQL语句中的 条件 where后支持数据中表字段的名字查询 和 访问web目录
- mysql查询语句中对字段内容补位(补零为例)length()函数获取某个字段数据长度
- Hibernate hql 查询指定字段并获取结果集
- Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
- Hibernate hql 查询指定字段并获取结果集
- 条件查询的时候,查询完成之后,不用在将选择的数据回传到页面,用于判断,让选择的option处于SELECT状态。
- 使用正则表达式获取Sql查询语句各项(表名、字段、条件、排序)
- Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
- 表id关联数据获取至页面,制作下拉框多选进行数据多项获取(字段处理)
- 如何从页面输入SQL查询条件得到后台结果返回前台页面
- Hibernate hql 查询指定字段并获取结果集
- 实现多条件查询 匹配数据库字段中多个数据
- angular做出提示框,获取输入的数据展示到界面上,判断数据是否存在,查询数据
- Hibernate hql 查询指定字段并获取结果集
- Hibernate中通过HQL/JPQL查询的方式实现动态数据获取
- Hibernate hql 查询指定字段并获取结果集的几种情况
- Hibernate hql 查询指定字段并获取结果集
- hibernate hql 查询指定字段并获取结果集,多表查询结果集
- MyBatis映射文件(集合数据的添加与获取,条件查询,模糊查询)