You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/12/15 08:55:16 UTC

[shenyu] branch master updated: Fix appAuth delete bug (#4268)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e301d4c0 Fix appAuth delete bug (#4268)
0e301d4c0 is described below

commit 0e301d4c0c21002d2655d1bf6981a6618d7f8a6b
Author: Liming Deng <li...@gmail.com>
AuthorDate: Thu Dec 15 16:55:07 2022 +0800

    Fix appAuth delete bug (#4268)
---
 .../shenyu/admin/service/impl/AppAuthServiceImpl.java      | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
index 6d568ec3d..53f099d9a 100644
--- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
+++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java
@@ -286,17 +286,19 @@ public class AppAuthServiceImpl implements AppAuthService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int delete(final List<String> ids) {
-        int affectCount = appAuthMapper.deleteByIds(ids);
-        authParamMapper.deleteByAuthIds(ids);
-        authPathMapper.deleteByAuthIds(ids);
-        if (affectCount <= 0) {
-            return affectCount;
+        if (CollectionUtils.isEmpty(ids)) {
+            return 0;
         }
-
         List<AppAuthDO> appAuthList = appAuthMapper.selectByIds(ids);
         if (CollectionUtils.isEmpty(appAuthList)) {
+            return 0;
+        }
+        int affectCount = appAuthMapper.deleteByIds(ids);
+        if (affectCount <= 0) {
             return affectCount;
         }
+        authParamMapper.deleteByAuthIds(ids);
+        authPathMapper.deleteByAuthIds(ids);
 
         List<AppAuthData> appAuthData = new ArrayList<>(appAuthList.size());
         appAuthList.forEach(appAuthDO -> {