</td>
</tr>
</table>
/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:36:26 AM
* @function:
* @param otherCondition
* @return:
*/
public String findByQueryCondition(String otherCondition) {
String errMessage = "";
List list = new ArrayList<QueryConVo>();
// 点击“字典维护”链接时候,执行此函数,判断bolByQuery标志,第一次获取页面传来的字典类型kind
if (bolByQuery) {
bolByQuery = false;
Map requestParams = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
// kindTemp,获取页面传来的字典类型的kind,并以此为条件查找对应的字典条目
kindTemp = (String) requestParams.get("kind");
// detailTemp,获取页面传来的字典类型的中文含义,用来设置字典条目列表的标题
// 页面传过来时出现非中文字符,需要转换为中文字符
detailTemp = CommonFunction
.escapeSequenceToString((String) requestParams
.get("detail"));
this.getDictionaryKind().setDetail(detailTemp);
this.getDictionaryKind().setKind(kindTemp);
if (StringUtils.isNotBlank(kindTemp)) {
QueryConVo conVo = new QueryConVo(dictionaryDAOEx.KIND,
kindTemp);
list.add(conVo);
}
}
// 点击字典条目列表页面“查询”按钮时候,根据条件查询相应的字典条目
else {
if (StringUtils.isNotBlank(kindTemp)) {
QueryConVo conVo = new QueryConVo(dictionaryDAOEx.KIND,
kindTemp);
list.add(conVo);
}
}
diclist = new ArrayList<Dictionary>();
GenarateConnection gc = (GenarateConnection) getCtx().getBean(
BizGlobalConstants.X_GCONNECTION);
String hql = "from Dictionary as ti where 1=1 and ti.scbz ='0'";
try {
this.diclist = gc.findListForPage(hql, list, this
.getCurrentPageNumber(), this.getPageSize());
this.rowCount = gc.findCountForPage(hql, list, this
.getCurrentPageNumber(), this.getPageSize());
this.setRowCount(rowCount);
} catch (Exception e) {
e.printStackTrace();
}
return errMessage.trim();
}
/**
*
* @author:denghuimin , yanghanming
* @createTime:Jul 7, 2009 10:46:56 AM
* @function:查询时在diclist表里面查,不用再次查找数据库
* @return:
*/
public String findInDiclist() {
String code = this.getCodeCondition();
List tempList = new ArrayList();
for (int i = 0; StringUtils.isNotBlank(code) && diclist != null
&& i < diclist.size(); i++) {
dictionary = (Dictionary) diclist.get(i);
if (dictionary.getCode().equals(code)) {
tempList.add(dictionary);
}
}
diclist = tempList;
this.setRowCount(diclist.size());
return null;
}
public String doBriefQuery() {
String errMessage = "";
errMessage = findByQueryCondition(dictionary.getKind());
this.fromOutcome = DictionaryListPane;
return errMessage;
}
查询: