维护字典类型,查询字典条目

<rich:column colspan="1"> <f:facet name="header"> <h:outputLabel value="维护字典" /> </f:facet> <div align="center"> <t:commandLink value="维护字典" styleClass="cbLink_table" action="#{dictionaryModel.onBriefQueryFormSubmit}"> <f:param name="kind" value="#{temp.kind}"></f:param> <f:param name="detail" value="#{temp.detail}"></f:param> </t:commandLink> </div> </rich:column>

 

<table align="center"> <tr> <td height="23" align="center" colspan="2" style="font-size: 15pt" mce_style="font-size: 15pt"> <strong><h:outputLabel value="#{dictionaryModel.dictionaryKind.detail}"> </h:outputLabel> </strong> </td> </tr> </table>

 

// 分页控制标志 private boolean bolByQuery = true; /** * * @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; }

查询:

 

<table> <tr> <td> 字典代码: <jsfext:inputText value="#{dictionaryModel.codeCondition}" id="code" tabindex="1" maxlength="50"> <jsfext:jseventlistener event="onkeydown" listener="convertEnter2Tab()" /> </jsfext:inputText> </td> <td> <t:commandButton id="briefQueryButton" value=" 查 询 " action="#{dictionaryModel.findInDiclist}" tabindex="2" forceId="true" /> </td> </tr> </table>

 

 

你可能感兴趣的:(维护字典类型,查询字典条目)