uep的保存操作分为ajaxgrid和ajaxform两种方式
1、ajaxgrid
public void storeInfoSave(){
try {
//两个dataWrap 一个dataWrap对应一个表
WzStoreInfo neWzStoreInfo = dataWrap.getData();
List<WzStoreCover> updateList = this.coverWrap.getUpdateList();
List<WzStoreCover> insertList = this.coverWrap.getInsertList() ;
List<WzStoreCover> deleteList = this.coverWrap.getDeleteList();
wzStoreCoverService.update(updateList,insertList,deleteList);
dataWrap.setData(neWzStoreInfo);
responseData.setAjaxDataWrap("dataWrap", dataWrap);
} catch (Exception e) {
e.printStackTrace();
responseData.setMessage("保存失败!"+e.getMessage());
}
} public void update( List<WzStoreCover> updateList,List<WzStoreCover> insertList, List<WzStoreCover> deleteList)
throws Exception {
if(insertList!=null && insertList.size()>0){
supplyDAO.create(insertList);
}
if(updateList!=null && updateList.size()>0){
supplyDAO.update(updateList);
}
if(deleteList!=null && deleteList.size()>0){
for (WzStoreCover bean : deleteList){
supplyDAO.remove(WzStoreUnitList.class, bean.getIncode());
}
}
}
2、ajaxform
public void save() {
try {
//保存仓库信息
WzStoreBill wzStoreBill = dataWrapBill.getData();
JPAUtil.update(wzStoreBill);
responseData.setAjaxDataWrap("dataWrapBill", dataWrapBill);
} catch (Exception e) {
e.printStackTrace();
responseData.setMessage("保存失败!"+e.getMessage());
}
}