欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

marmot framework 高级查询应用体验

程序员文章站 2022-05-03 12:53:57
...
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