Merge branch 'develop-business-css' of http://121.37.111.42:3000/ThbTech/JavaProjectRepo into develop-business-css
This commit is contained in:
commit
5a4423b276
@ -131,7 +131,7 @@ public class ProjectController {
|
||||
@Operation(summary = "删除项目(单条)", description = "根据项目ID删除项目")
|
||||
public boolean delete(@PathVariable @Parameter(description = "项目ID", required = true) String id) {
|
||||
projectAccessHelper.assertCanWriteProject(id);
|
||||
return projectService.removeById(id);
|
||||
return projectService.deleteProjectCascade(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,14 @@ public class ProjectController {
|
||||
projectAccessHelper.assertCanWriteProject(id);
|
||||
}
|
||||
}
|
||||
return projectService.removeByIds(ids);
|
||||
boolean ok = true;
|
||||
if (ids != null) {
|
||||
for (String id : ids) {
|
||||
if (id == null || id.isBlank()) continue;
|
||||
ok = projectService.deleteProjectCascade(id) && ok;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -49,6 +49,8 @@ public interface ProjectService extends IService<Project> {
|
||||
*/
|
||||
java.util.Map<String, Object> runSimulation(String projectId, String scenarioId, java.util.Map<String, Object> params);
|
||||
|
||||
boolean deleteProjectCascade(String projectId);
|
||||
|
||||
// List<SimInfluenceNode> loadSimInfluenceNodes(String projectId);
|
||||
|
||||
}
|
||||
|
||||
@ -1601,7 +1601,13 @@ public class ProjectServiceImpl
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteProjectCascade(String projectId) {
|
||||
@Override
|
||||
public boolean deleteProjectCascade(String projectId) {
|
||||
deleteProjectCascadeInternal(projectId);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void deleteProjectCascadeInternal(String projectId) {
|
||||
List<Scenario> scenarios = scenarioService.list(new QueryWrapper<Scenario>().select("scenario_id").eq("project_id", projectId));
|
||||
List<String> scenarioIds = scenarios.stream().map(Scenario::getScenarioId).filter(Objects::nonNull).toList();
|
||||
if (!scenarioIds.isEmpty()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user