Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
来源:互联网 发布:智能机锁屏软件 编辑:程序博客网 时间:2024/06/15 20:12
Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
1. 1. 配置条件字段@Conditional 1 1
2. 2. 配置条件字段显示类型为range----@Conditional(displayType = displayType.rang, rangStart = rang.start, rangEnd = rang.end,op=op.range) 1
3. #----show condition page list 1
4. 提交条件查询表单by dwr 1
5. @filter :: set filter condition use or not use ....or save form .... 2
6. @converter 2
7. #----保存每一个条件map 4 调试 2
8. #====start 2
9. Sigle,range>>>> wehere cause 2
10. Hb pageing 2
11. Ret page map 2
12. #----code 3
13. 参考 5
1. 1. 配置条件字段@Conditional 1
2. 2. 配置条件字段显示类型为range----@Conditional(displayType = displayType.rang, rangStart = rang.start, rangEnd = rang.end,op=op.range)
或者dispayType.single..
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
3. #----show condition page list
4. 提交条件查询表单by dwr
//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});
});
}
5. @filter :: set filter condition use or not use ....or save form ....
6. @converter
7. #----保存每一个条件map 4 调试
filex.save_safe( core.toJsonStr(QueryPropertyssMap) , "c:\\json2.txt");
8. #====start
for (Field fld : flds) {
Conditional cdt = fld.getAnnotation(Conditional.class);
if (cdt == null)
continue;
.......
9. Sigle,range>>>> wehere cause
10. Hb pageing
11. Ret page map
Map mp=new HashMap();
mp.put("total" ,SafeVal.val( threadLocal_rowsCount.get(),list_sub.size()));
mp.put("rows",list_sub);
12. #----code
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;
}
13. 参考
atitit.提升开发效率---MDA 软件开发方式的革命(5)----列表查询建模 - attilax的专栏 - 博客频道 - CSDN.NET.htm
- Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
- Atitit.列表页面and条件查询的实现最佳实践(2)------翻页 分页 控件的实现java .net php
- oracle between and 的简单条件查询
- mysql带 AND 的多条件查询
- 查询条件提交页面
- mybatis 拼装 and和or 查询条件
- thinkphp多条件查询(AND, OR)
- Lucene进阶:and 和or的条件查询
- Lucene进阶:and 和or的条件查询
- where查询条件的指定,between and,in,like
- Lucene进阶:and 和or的条件查询 .
- MySQL带AND关键字的多条件查询
- 存储过程中的符合条件查询 and 1= ''+@knlgName+''
- 时间类型数据使用between ...and ..语句条件查询时应注意的问题
- atitit.导航的实现最佳实践and声明式编程
- mongo java中and、or多条件查询
- oracle left join 查询on中出现and条件
- myBatis查询某个时间区间数据<if test=""> 如何写判断条件,and 里面的内容怎么写?
- 多重继承和虚基类
- CSS中的长度问题-------Day76
- mac jdk配置
- tomcat配置虚拟主机
- IOS开发学习笔记-(3) 进度条、等待动画开始停止
- Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据
- 分治法(Scheme) -- 快速排序
- at&T语法格式
- HDR Image encoding formats
- 一周小节
- Linux命令exit - 退出当前shell
- HDOJ题目2086 A1 = ?(数学)
- .net mvc 微信开发笔记(五)------JSON解析,自定义菜单
- Oracle GoldenGate环境中主库和备库 网络突然中断后,主端的dp进程无法启动的问题