moremind commented on code in PR #5740:
URL: https://github.com/apache/shenyu/pull/5740#discussion_r1829218767
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/NamespaceServiceImpl.java:
##########
@@ -83,10 +114,34 @@ public String delete(final List<String> ids) {
if (ids.contains(Constants.DEFAULT_NAMESPACE_PRIMARY_KEY)) {
return AdminConstants.SYS_DEFAULT_NAMESPACE_ID_DELETE;
}
- List<NamespaceDO> namespaceDOS = namespaceMapper.selectByIds(ids);
- if (CollectionUtils.isEmpty(namespaceDOS)) {
+ List<String> namespaceIdList =
namespaceMapper.selectByIds(ids).stream().map(NamespaceDO::getNamespaceId).collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(namespaceIdList)) {
return AdminConstants.SYS_NAMESPACE_ID_NOT_EXIST;
}
+ List<NamespacePluginVO> namespacePluginVOS =
namespacePluginRelMapper.selectAllByNamespaceIds(namespaceIdList);
+ if (CollectionUtils.isNotEmpty(namespacePluginVOS)) {
+ return "Plugins exist under those namespace!";
+ }
+ List<SelectorDO> selectorDOS =
selectorMapper.selectAllByNamespaceIds(namespaceIdList);
+ if (CollectionUtils.isNotEmpty(selectorDOS)) {
+ return "selector exist under those namespace!";
+ }
+ List<RuleDO> ruleDOList =
ruleMapper.selectAllByNamespaceIds(namespaceIdList);
+ if (CollectionUtils.isNotEmpty(ruleDOList)) {
+ return "rule exist under those namespace!";
+ }
+ List<MetaDataDO> metaDataDOList =
metaDataMapper.findAllByNamespaceIds(namespaceIdList);
+ if (CollectionUtils.isNotEmpty(metaDataDOList)) {
+ return "metaData exist under those namespace!";
+ }
+ List<AuthPathDO> authPathDOList =
authPathMapper.findByNamespaceIds(namespaceIdList);
+ if (CollectionUtils.isNotEmpty(authPathDOList)) {
+ return "authPath exist under those namespace!";
+ }
+ List<DiscoveryDO> discoveryDOList =
discoveryMapper.selectAllByNamespaceIds(namespaceIdList);
+ if (CollectionUtils.isNotEmpty(discoveryDOList)) {
+ return "discovery exist under those namespace!";
Review Comment:
may throw exception
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]