1. 程式人生 > >Uep查詢語句總結

Uep查詢語句總結

col req class data ati property 接收 eid 前臺

今天沒事幹總結一下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
});
}

Uep查詢語句總結