21
21
import org .apache .commons .collections4 .CollectionUtils ;
22
22
import org .apache .commons .lang3 .StringUtils ;
23
23
import org .apache .shenyu .admin .exception .ShenyuAdminException ;
24
+ import org .apache .shenyu .admin .mapper .AppAuthMapper ;
24
25
import org .apache .shenyu .admin .mapper .AuthPathMapper ;
25
26
import org .apache .shenyu .admin .mapper .DiscoveryMapper ;
26
27
import org .apache .shenyu .admin .mapper .MetaDataMapper ;
27
28
import org .apache .shenyu .admin .mapper .NamespaceMapper ;
28
- import org .apache .shenyu .admin .mapper .AppAuthMapper ;
29
29
import org .apache .shenyu .admin .mapper .NamespacePluginRelMapper ;
30
30
import org .apache .shenyu .admin .mapper .RuleMapper ;
31
31
import org .apache .shenyu .admin .mapper .SelectorMapper ;
32
32
import org .apache .shenyu .admin .model .dto .NamespaceDTO ;
33
33
import org .apache .shenyu .admin .model .entity .AppAuthDO ;
34
- import org .apache .shenyu .admin .model .entity .DiscoveryDO ;
35
34
import org .apache .shenyu .admin .model .entity .MetaDataDO ;
36
35
import org .apache .shenyu .admin .model .entity .NamespaceDO ;
37
36
import org .apache .shenyu .admin .model .entity .RuleDO ;
@@ -141,17 +140,17 @@ public String delete(final List<String> ids) {
141
140
if (CollectionUtils .isEmpty (namespaceIdList )) {
142
141
throw new ShenyuAdminException (AdminConstants .SYS_NAMESPACE_ID_NOT_EXIST );
143
142
}
144
- List <NamespacePluginVO > namespacePluginVOS = namespacePluginRelMapper .selectAllByNamespaceIds (namespaceIdList );
145
- if (CollectionUtils .isNotEmpty (namespacePluginVOS )) {
146
- throw new ShenyuAdminException ("Plugins exist under those namespace!" );
143
+ List <RuleDO > ruleDOList = ruleMapper .selectAllByNamespaceIds (namespaceIdList );
144
+ if (CollectionUtils .isNotEmpty (ruleDOList )) {
145
+ throw new ShenyuAdminException ("rule exist under those namespace!" );
147
146
}
148
147
List <SelectorDO > selectorDOS = selectorMapper .selectAllByNamespaceIds (namespaceIdList );
149
148
if (CollectionUtils .isNotEmpty (selectorDOS )) {
150
149
throw new ShenyuAdminException ("selector exist under those namespace!" );
151
150
}
152
- List <RuleDO > ruleDOList = ruleMapper .selectAllByNamespaceIds (namespaceIdList );
153
- if (CollectionUtils .isNotEmpty (ruleDOList )) {
154
- throw new ShenyuAdminException ("rule exist under those namespace!" );
151
+ List <NamespacePluginVO > namespacePluginVOS = namespacePluginRelMapper .selectAllByNamespaceIds (namespaceIdList );
152
+ if (CollectionUtils .isNotEmpty (namespacePluginVOS )) {
153
+ throw new ShenyuAdminException ("Plugins exist under those namespace!" );
155
154
}
156
155
List <MetaDataDO > metaDataDOList = metaDataMapper .findAllByNamespaceIds (namespaceIdList );
157
156
if (CollectionUtils .isNotEmpty (metaDataDOList )) {
@@ -161,10 +160,6 @@ public String delete(final List<String> ids) {
161
160
if (CollectionUtils .isNotEmpty (appPathDOList )) {
162
161
throw new ShenyuAdminException ("appPath exist under those namespace!" );
163
162
}
164
- List <DiscoveryDO > discoveryDOList = discoveryMapper .selectAllByNamespaceIds (namespaceIdList );
165
- if (CollectionUtils .isNotEmpty (discoveryDOList )) {
166
- throw new ShenyuAdminException ("discovery exist under those namespace!" );
167
- }
168
163
namespaceMapper .deleteByIds (ids );
169
164
return ShenyuResultMessage .DELETE_SUCCESS ;
170
165
}
0 commit comments