路由规则删除需未关联服务

This commit is contained in:
akun 2024-05-14 17:57:57 +08:00
parent 9e0de4ba4f
commit a9decb5582

View File

@ -1,6 +1,7 @@
package com.sf.service.gateway.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
@ -195,6 +196,9 @@ public class GatewayRouteServiceImpl implements IGatewayRouteService
private void checkDeleteConditions(Collection<Long> ids) {
List<GatewayServer> serverList = gatewayServerService.selectGatewayServerByRouteIds(ids);
if (CollUtil.isNotEmpty(serverList)){
serverList = serverList.stream().filter(server -> GatewayServiceModel.ROUTE.getCode().equals(server.getServiceModel())).collect(Collectors.toList());
}
Assert.isTrue(CollUtil.isEmpty(serverList),"存在关联服务,删除失败!");
}