|
@@ -8,6 +8,7 @@ import com.siwei.apply.mapper.ProjectMapper;
|
|
|
import com.siwei.apply.service.ProjectService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -60,10 +61,19 @@ public class ProjectImpl implements ProjectService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void delete(String projectId) {
|
|
|
- if (projectId == null || projectId.isEmpty()) {
|
|
|
- throw new IllegalArgumentException("Project ID cannot be null or empty");
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void batchDelete(List<String> ids) {
|
|
|
+ if (ids == null || ids.isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("IDs list cannot be null or empty");
|
|
|
}
|
|
|
- projectMapper.delete(projectId);
|
|
|
+
|
|
|
+ // 验证每个ID都不为空
|
|
|
+ for (String id : ids) {
|
|
|
+ if (id == null || id.trim().isEmpty()) {
|
|
|
+ throw new IllegalArgumentException("ID cannot be null or empty");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ projectMapper.batchDelete(ids);
|
|
|
}
|
|
|
}
|