Kaynağa Gözat

fix 修复 加解密拦截器null问题

疯狂的狮子Li 2 yıl önce
ebeveyn
işleme
84871d4cfb

+ 4 - 0
ruoyi-common/ruoyi-common-encrypt/src/main/java/com/ruoyi/common/encrypt/interceptor/MybatisDecryptInterceptor.java

@@ -1,6 +1,7 @@
 package com.ruoyi.common.encrypt.interceptor;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.encrypt.annotation.EncryptField;
 import com.ruoyi.common.encrypt.core.EncryptContext;
@@ -55,6 +56,9 @@ public class MybatisDecryptInterceptor implements Interceptor {
      * @param sourceObject 待加密对象
      */
     private void decryptHandler(Object sourceObject) {
+        if (ObjectUtil.isNull(sourceObject)) {
+            return;
+        }
         if (sourceObject instanceof Map<?, ?> map) {
             map.values().forEach(this::decryptHandler);
             return;

+ 3 - 0
ruoyi-common/ruoyi-common-encrypt/src/main/java/com/ruoyi/common/encrypt/interceptor/MybatisEncryptInterceptor.java

@@ -65,6 +65,9 @@ public class MybatisEncryptInterceptor implements Interceptor {
      * @param sourceObject 待加密对象
      */
     private void encryptHandler(Object sourceObject) {
+        if (ObjectUtil.isNull(sourceObject)) {
+            return;
+        }
         if (sourceObject instanceof Map<?, ?> map) {
             map.values().forEach(this::encryptHandler);
             return;