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

This commit is contained in:
疯狂的狮子Li 2023-03-07 22:22:50 +08:00
parent d38fa0ec05
commit 91a61b6927
2 changed files with 7 additions and 0 deletions

View File

@ -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;

View File

@ -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;