Пример #1
0
 /* (non-Javadoc)
  * @see com.cloud.erp.dao.SalesContractDao#delSalesContract(java.lang.Integer)
  */
 @Override
 public boolean delSalesContract(Integer contractId) {
   // TODO Auto-generated method stub
   Integer userId = Constants.getCurrentUser().getUserId();
   String status = Constants.PERSISTENCE_DELETE_STATUS;
   Date date = new Date();
   SalesContract salesContract = (SalesContract) baseDao.get(SalesContract.class, contractId);
   salesContract.setLastmod(date);
   salesContract.setModifier(userId);
   salesContract.setStatus(status);
   baseDao.deleteToUpdate(salesContract);
   String hql =
       "from SalesContractEntry t where t.status='A' and t.contract.interId=" + contractId;
   List<SalesContractEntry> salesContractEntries = baseDao.find(hql);
   for (SalesContractEntry salesContractEntry : salesContractEntries) {
     salesContractEntry.setLastmod(date);
     salesContractEntry.setModifier(userId);
     salesContractEntry.setStatus(status);
     baseDao.deleteToUpdate(salesContractEntry);
   }
   hql = "from SalesContractScheme t where t.status='A' and t.contract.interId=" + contractId;
   List<SalesContractScheme> salesContractSchemes = baseDao.find(hql);
   for (SalesContractScheme salesContractScheme : salesContractSchemes) {
     salesContractScheme.setLastmod(date);
     salesContractScheme.setModifier(userId);
     salesContractScheme.setStatus(status);
     baseDao.deleteToUpdate(salesContractScheme);
   }
   return true;
 }
Пример #2
0
 private boolean delEntry(List<SalesContractEntry> entries) {
   Integer userId = Constants.getCurrentUser().getUserId();
   if (null != entries && !entries.isEmpty()) {
     for (SalesContractEntry salesContractEntry : entries) {
       salesContractEntry.setLastmod(new Date());
       salesContractEntry.setModifier(userId);
       salesContractEntry.setStatus(Constants.PERSISTENCE_DELETE_STATUS);
       baseDao.deleteToUpdate(salesContractEntry);
     }
   }
   return true;
 }