|
@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -34,7 +36,17 @@ public class AppsController {
|
|
@ApiOperation("根据ID删除应用软件接口")
|
|
@ApiOperation("根据ID删除应用软件接口")
|
|
@DeleteMapping("/delete/{id}")
|
|
@DeleteMapping("/delete/{id}")
|
|
public Result<Object> delete(@PathVariable(name = "id") Integer id) {
|
|
public Result<Object> delete(@PathVariable(name = "id") Integer id) {
|
|
- return Result.succ(appsService.removeById(id));
|
|
|
|
|
|
+ List<Integer> descIds = appsDescService.lambdaQuery()
|
|
|
|
+ .eq(AppsDesc::getAppId, id)
|
|
|
|
+ .list().stream().map(c -> c.getId()).collect(Collectors.toList());
|
|
|
|
+ appsDescService.removeByIds(descIds);
|
|
|
|
+ List<Integer> clientIds = appsClientsService.lambdaQuery()
|
|
|
|
+ .eq(AppsClients::getAppId, id)
|
|
|
|
+ .list().stream().map(c -> c.getId()).collect(Collectors.toList());
|
|
|
|
+ appsClientsService.removeByIds(clientIds);
|
|
|
|
+
|
|
|
|
+ appsService.removeById(id);
|
|
|
|
+ return Result.ok();
|
|
}
|
|
}
|
|
|
|
|
|
public AppsController(IAppsService appsService, IAppsDescService appsDescService, IAppsClientsService appsClientsService) {
|
|
public AppsController(IAppsService appsService, IAppsDescService appsDescService, IAppsClientsService appsClientsService) {
|