/* (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; }
@Override public List<SalesContractEntry> findSalesContractEntriesById(Integer contractId) { // TODO Auto-generated method stub String hql = "from SalesContractEntry t where t.status='A' and t.contract.interId=" + contractId; return baseDao.find(hql); }
/* (non-Javadoc) * @see com.cloud.erp.dao.SalesContractDao#findSalesContracts(java.util.Map, com.cloud.erp.utils.PageUtil) */ @Override public List<SalesContract> findSalesContracts(Map<String, Object> params, PageUtil pageUtil) { String dataRule = dataPermissionAssign.translate("SalesContract"); String hql = "from SalesContract t where t.status='A'" + dataRule; hql += Constants.getSearchConditionsHQL("t", params); hql += Constants.getGradeSearchConditionsHQL("t", pageUtil); return baseDao.find(hql, params, pageUtil.getPage(), pageUtil.getRows()); }