1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| /** * 删除分类时,demand_product表和demand表中的记录要同步删除 * * @param demandId 要删除的分类的id */ @Transactional(transactionManager = "transactionManager", propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) public void deleteDemand(int demandId) throws Exception { deleteDemandProduct(demandId); deleteDemand0(demandId); }
private void deleteDemand0(int demandId) { jdbcTemplate.update(new PreparedStatementCreatorImpl("UPDATE demand SET deleted=1 where demand_id in (?)", new Object[] { demandId })); }
private void deleteDemandProduct(int demandId) { jdbcTemplate.update(new PreparedStatementCreatorImpl("delete from `demand_product` where demand_id = ?", new Object[] { demandId })); }
|