Quellcode durchsuchen

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

疯狂的狮子Li vor 2 Jahren
Ursprung
Commit
91a61b6927

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

@@ -1,6 +1,7 @@
 package com.ruoyi.framework.encrypt;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.ruoyi.common.annotation.EncryptField;
 import com.ruoyi.common.encrypt.EncryptContext;
 import com.ruoyi.common.enums.AlgorithmType;
@@ -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<?, ?>) sourceObject).values().forEach(this::decryptHandler);
             return;

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

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