marmot framework 高级查询应用体验

url:marmot/query/query-box.jsp
view: org.marmot.framework.query.view.QueryBox

tabsetQuery 对象的事件 <afterTabChange> 代码中添加 以下代码 用于过滤不想用于查询的字段

   if(field.getTag() == 'hide') {
        continue;
    }

   if(field.getTag() == 'hide') {
       datasetColumn.moveNext();
   }




针对服务器端对参数的处理代码示例:

if(null != condition) {
			if(condition instanceof Query) {
				Query query = (Query)condition;
				List<QueryWhere> list = query.getWheres(); 
				QueryWhere[] removeQueryWheres = new QueryWhere[1];
				for(QueryWhere qWhere: list) {
					if("DWH".equals(qWhere.getFieldName())) {
//						list.remove(qWhere);
						removeQueryWheres[0] = qWhere;
					}
					if(qWhere.getCompareOp().equals("like-free")
							||qWhere.getCompareOp().equals("like-end")
							||qWhere.getCompareOp().equals("like-start")) {
	//qWhere.setCompareValue("%"+qWhere.getCompareValue()); 					
           qWhere.setCompareOp("like");
					} 
				}
				list.remove(removeQueryWheres[0]);
				HQLQueryBuilder queryBuilder = new HQLQueryBuilder();
				QL ql = queryBuilder.buildQL(query);
				if(null != ql) {
					String whereClause = ql.getWhereClause().toString();
					whereClause = whereClause == null || "".equals(whereClause) ?" 1=1 ":whereClause;
					Map valueMap = ql.getParameters();
					String[] names = ql.getParameterNames();
					st.setSql(preSql +" and "+ whereClause +")");
					for(String str : names) {
						Object tmpObj = valueMap.get(str);
						String ttString = new String(tmpObj.toString().getBytes("utf-8"),"?");
						st.parameters().setValue(str, ttString);
//						System.out.println(str+":"+ttString);
					}
				} else {
					st.setSql(preSql + ")");
				}
			} else {
				st.setSql(preSql + ")");
			}
		} else {
			st.setSql(preSql + ")");
		}

你可能感兴趣的:(应用服务器,jsp)