您的位置:首页 > 其它

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";
}  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐