//数据回滚
@Transactional(rollbackFor=Exception.class) public boolean deleteUser(String userIds) { int failflag = 0; if(!Constant.isEmpty(userIds)) { String[] userId = userIds.split(","); if(userId.length!=0) { for(int i=0;i<userId.length;i++) { if(!userDao.deleteUser(Integer.valueOf(userId[i]))) { failflag = failflag +1; } } } } if(failflag==0) { return true; }else { //数据回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return false; } }
// 异常回滚
@Transactional(rollbackFor = Exception.class) public byte[] batchSignature(HttpServletRequest request) { try{ ........ ........ }catch(Exception e){ e.printStackTrace(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return ResponseUtils.responseJsonResult(false); } }