今天没事干总结一下uep查询语句:
第一种方法:
public List<WzInitializeStoreInfo> retrieve(QueryParamList param, PageInfo pageInfo,SortParamList sort) throws BaseRunException {
StringBuffer jpql=new StringBuffer();
jpql.append("select new com.haiyisoft.entity.wz.WzInitializeStoreInfo(w.incode,w.batchId,w.wzIncode,w.storeId,w.buyPrice,w.taxRatio,w.storeSite,w.storeAdvanceNum,w.storeFactNum,w.madeDate,w.validDate,w.productIncode,"
+ "w.batchType,c.wzName,c.wzEntry,c.jlUnit)");
jpql.append(" from WzInitializeStoreInfo w,WzCode c where w.wzIncode=c.wzIncode");
if(param.get("batchId")!=null){
jpql.append(" and w.batchId="+param.get("batchId").getValue());
}
if(param.get("wzEntry")!=null){
jpql.append(" and c.wzEntry="+param.get("wzEntry").getValue());
}
if(param.get("wzName")!=null){
jpql.append(" and c.wzName like "+"‘"+param.get("wzName").getValue()+"‘");
}
if(param.get("companyId")!=null){
jpql.append(" and c.companyId="+param.get("companyId").getValue());
}
List<Object> list=supplyDAO.find(jpql.toString(), sort,pageInfo);
List<WzInitializeStoreInfo> siteList=new ArrayList<WzInitializeStoreInfo>();
for(int i=0;i<list.size();i++){
siteList.add((WzInitializeStoreInfo)list.get(i));
}
return siteList;
}
第二种方法:
public List<WzInitializeStoreInfo> retrieve(QueryParamList param, PageInfo pageInfo,SortParamList sort) throws BaseRunException {
StringBuffer jpql=new StringBuffer();
jpql.append("select new com.haiyisoft.entity.wz.WzInitializeStoreInfo(w.incode,w.batchId,w.wzIncode,w.storeId,w.buyPrice,w.taxRatio,w.storeSite,w.storeAdvanceNum,w.storeFactNum,w.madeDate,w.validDate,w.productIncode,"
+ "w.batchType,c.wzName,c.wzEntry,c.jlUnit)");
jpql.append(" from WzInitializeStoreInfo w,WzCode c where w.wzIncode=c.wzIncode");
if(param.get("batchId")!=null){
jpql.append(" and w.batchId= :batchId");
}
if(param.get("wzEntry")!=null){
jpql.append(" and c.wzEntry= :wzEntry");
}
if(param.get("wzName")!=null){
jpql.append(" and c.wzName like :wzName ");
}
if(param.get("companyId")!=null){
jpql.append(" and c.companyId= :companyId");
}
List<Object> list=supplyDAO.find(jpql.toString(), param,sort,pageInfo);
List<WzInitializeStoreInfo> siteList=new ArrayList<WzInitializeStoreInfo>();
for(int i=0;i<list.size();i++){
siteList.add((WzInitializeStoreInfo)list.get(i));
}
return siteList;
}
主要是赋值和执行语句的参数有所差别。
然后是uep前台数据传入后台的俩种方式
function showDetail(cell) {
//此时要问后台要数据,要新主数据的从数据,
var data = ajaxgrid.collectData(true, "all");
var unitDate = unitGrid.collectData(true, "all");
var a =cell["storeId"];
var dataArr = [];
dataArr.push(data);
dataArr.push(unitDate);
$.request({
action : "retrieveAll",
data : dataArr,
params : {
"storeId" : cell["storeId"], 对于这种后台Action需要private String storeId;然后setter和getter方法
"property.storeId" : a 对于这种传值后台接收只需要this.getProperty("storeId);
},
success : ajax_initdb
});
}