From 910c0d09275fc7ac411a0bcbe87bc7b5ead533ee Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 28 八月 2023 10:36:23 +0800
Subject: [PATCH] 修改redis的缓存策略

---
 src/main/java/com/moon/server/controller/sys/AuthController.java |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/moon/server/controller/sys/AuthController.java b/src/main/java/com/moon/server/controller/sys/AuthController.java
index 89a3160..eaf3db5 100644
--- a/src/main/java/com/moon/server/controller/sys/AuthController.java
+++ b/src/main/java/com/moon/server/controller/sys/AuthController.java
@@ -139,10 +139,8 @@
                 entity.setCreateUser(ue.getId());
             }
 
+            permsService.clearPermsCache();
             int count = authService.insertAuth(entity);
-            if (count > 0) {
-                permsService.clearPermsCache();
-            }
 
             return success(count);
         } catch (Exception ex) {
@@ -165,10 +163,8 @@
                 }
             }
 
+            permsService.clearPermsCache();
             int count = authService.insertAuths(list);
-            if (count > 0) {
-                permsService.clearPermsCache();
-            }
 
             return success(count);
         } catch (Exception ex) {
@@ -184,10 +180,8 @@
     @GetMapping(value = "/deleteAuth")
     public ResponseMsg<Integer> deleteAuth(int id) {
         try {
+            permsService.clearPermsCache();
             int count = authService.deleteAuth(id);
-            if (count > 0) {
-                permsService.clearPermsCache();
-            }
 
             return success(count);
         } catch (Exception ex) {
@@ -207,10 +201,8 @@
                 return fail("id鏁扮粍涓嶈兘涓虹┖", -1);
             }
 
+            permsService.clearPermsCache();
             int count = authService.deleteAuths(ids);
-            if (count > 0) {
-                permsService.clearPermsCache();
-            }
 
             return success(count);
         } catch (Exception ex) {
@@ -232,10 +224,8 @@
                 entity.setUpdateUser(ue.getId());
             }
 
+            permsService.clearPermsCache();
             int count = authService.updateAuth(entity);
-            if (count > 0) {
-                permsService.clearPermsCache();
-            }
 
             return success(count);
         } catch (Exception ex) {

--
Gitblit v1.9.3