UEP-查询方式总结
public void retrieve() { QueryParamList params = getQueryParam("dataWrap"); //获取页面上的参数,即查询条件 dataWrap.setDataList(uepCustomerService.retrieve(params, dataWrap.getPageInfo(), dataWrap.getSortOptions())); //表格(ajaxgrid):根据查询条件,查询出对应的结果集,把结果集的list放在表格的dataList里 responseData.setAjaxDataWrap("dataWrap", dataWrap); //responseData里有map集合,可以把多个dataWrap传递给前台 } public void retrieve() { QueryParamList params = getQueryParam("dataWrap"); //获取前台传递过来的查询参数 //QueryParamList方法讲解 QueryParamList params1 = new QueryParamList(); params1.addParam("contractName","甲骨文",QueryParam.RELATION_LIKE); params1.addParam("id",new BigDecimal("1"),QueryParam.RELATION_EQUAL); //SortParamList(排序查询)方法讲解 SortParamList sort = new SortParamList(); sort.addParam("customerName",SortParam.SORT_TYPE_ASCENDING); sort.addParam("customerName",SortParam.SORT_TYPE_ASCENDING,"顾客"); //顾客是别名 //JPQL String jpql = "select t from UepCustomer t where t.customerName like : name" ; //UepCustomer是UEP创建的对象名,不是数据库的表名 QueryParamList params2 = new QueryParamList(); Params2.addParam("customerName","甲骨文",QueryParam.RELATION_LIKE); List result = JPAUtil.find(jpql,params2); List list = new ArrayList(); For(object o : result){ List.add((UepCustomer)o); } dataWrap.setDataList(list); dataWrap.setDataList(uepCustomerService.retrieve(params1, dataWrap.getPageInfo(), sort )); responseData.setAjaxDataWrap("dataWrap", dataWrap); } }
--DBTool查询
http://www.cnblogs.com/bhy-1116/p/8316124.html
--上述JPQL存在问题
--JPQL具体查询
http://www.cnblogs.com/kkdf/p/8108761.html
- 前台获取ID
function testShow(cell){ var cid = cell["id"]; //获取主键ID $.showModalDialog("haiYi!doshow.do?cusId="+cid, "用户信息展示",null,null,400,600,0); //前台获取的ID传给后台定义的ID }
- 后台通过ID查询
dataWrap.setData(demoTopicService.findById(Long.valueOf(cusId)));
UepCustomer cus=JPAUtil.loadById(UepCustomer.class, new BigDecimal(cusId));
谢谢大家的阅读,阅读后记得关注一下呦!