| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteTestByIds(Long[] testIds, String updateBy) |
| | | public int deleteTestByIds(Long[] testIds, Long operatorId, String updateBy) |
| | | { |
| | | if (testIds == null || testIds.length == 0) throw new ServiceException("请选择要删除的测试"); |
| | | int rows = 0; |
| | |
| | | TTest current = testMapper.selectTestByIdForUpdate(testId); |
| | | if (current == null) throw new ServiceException("测试不存在"); |
| | | if (!NOT_MONITORED.equals(current.getMonitoringStatus())) throw new ServiceException("开始监测后不能删除测试"); |
| | | rows += testMapper.deleteTestById(testId, updateBy); |
| | | loadConfiguration(current); |
| | | int deleted = testMapper.deleteTestById(testId, updateBy); |
| | | if (deleted != 1) throw new ServiceException("测试配置已变更,请刷新后重试"); |
| | | testMapper.insertTestAudit(testId, "TEST_DELETED", operatorId, updateBy, |
| | | JSON.toJSONString(current), null); |
| | | rows += deleted; |
| | | } |
| | | return rows; |
| | | } |