/* (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; }
private boolean delScheme(List<SalesContractScheme> schemes) { Integer userId = Constants.getCurrentUser().getUserId(); if (null != schemes && !schemes.isEmpty()) { for (SalesContractScheme salesContractScheme : schemes) { salesContractScheme.setLastmod(new Date()); salesContractScheme.setModifier(userId); salesContractScheme.setStatus(Constants.PERSISTENCE_DELETE_STATUS); baseDao.deleteToUpdate(salesContractScheme); } } return true; }