标签:
Atitit.列表页and查询条件的最佳实践(1)------设置查询条件and提交查询and返回json数据
3. #----show condition page list 1
5. @filter :: set filter condition use or not use ....or save form .... 2
9. Sigle,range>>>> wehere cause 2
或者dispayType.single..
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
//queryBtn_click
Query(1)
function query(isResetPage1)
{
if(isResetPage1==1)
resetPageTo1();
var mp=dwr.util.getFormValues("formx");
elmtC.findByPropertyss_page(mp ,function(data){
//alert("保存成功");
bindTableData(data.rows);
setPageInfo({"total":data.total,"pageSize":10});
});
}
filex.save_safe( core.toJsonStr(QueryPropertyssMap) , "c:\\json2.txt");
for (Field fld : flds) {
Conditional cdt = fld.getAnnotation(Conditional.class);
if (cdt == null)
continue;
.......
Map mp=new HashMap();
mp.put("total" ,SafeVal.val( threadLocal_rowsCount.get(),list_sub.size()));
mp.put("rows",list_sub);
public List findByPropertyss(Map QueryPropertyssMap) {
// log.debug("finding GvMaterial instance with property: " +
// propertyName + ", value: " + value);
core. log("---o720--");
core.logMap(QueryPropertyssMap);
filex.save_safe( core.toJsonStr(QueryPropertyssMap) , "c:\\json2.txt");
String propertyName;
Object value;
Criteria c = getSession().createCriteria(GvMaterial.class);
Field[] flds = GvMaterial.class.getDeclaredFields();
for (Field fld : flds) {
try {
String fldName = fld.getName();
if (fldName.startsWith("playtime")) {
String s = "";
}
if (!includeFldInfoPostMap(QueryPropertyssMap, fldName))
continue;
Conditional cdt = fld.getAnnotation(Conditional.class);
if (cdt == null)
continue;
if (cdt.adptr() != None.class) // cstm mode
//
{
List li = adptrMOde(QueryPropertyssMap, c, fld, fldName,
cdt);
addExpresss(c, li);
} else if (cdt.displayType().equals(displayType.single)) {
// if
// (fld.getType().getName().equals(String.class.getName()))
// {
List<Criterion> exprsLi = getExprs(fldName, cdt.op(),
QueryPropertyssMap);
core.log(String.format("--o7f1: dbg fldinfo: %s---%s ",
fldName, QueryPropertyssMap.get(fldName)));
addExpresss(c, exprsLi);
// Restrictions.like(fldName, "%" + + "%")
} else if (cdt.displayType().equals(displayType.rang)) {
List<Criterion> exprsLi = getExprs(fldName, cdt.op(),
QueryPropertyssMap);
core.log(String.format("--o7f1: dbg fldinfo: %s---%s ",
fldName, QueryPropertyssMap.get(fldName)));
addExpresss(c, exprsLi);
}
//
} catch (Exception e) {
core.log(e);
}
// c.add(Restrictions.eq("aname",name));//eq是等于,gt是大于,lt是小于,or是或
}
c.addOrder(Order.desc("materialId"));
List<GvMaterial> list = c.list();
threadLocal_rowsCount.set(list.size());
Object page = QueryPropertyssMap.get("page_page");
List<GvMaterial> list_sub = PagingUtil.getList(list,
QueryPropertyssMap.get("pagesize"), page);
return list_sub;
}
atitit.提升开发效率---MDA 软件开发方式的革命(5)----列表查询建模 - attilax的专栏 - 博客频道 - CSDN.NET.htm
版权声明:本文博主原创文章,博客,未经同意不得转载。
Atitit.列表页and查询条件的最佳实践(1)------设定搜索条件and提交查询and返回json数据
标签:
原文地址:http://www.cnblogs.com/yxwkf/p/4852639.html