From 8eb43cbea1432ea2d696a558c72bcafaa302b609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 13 Jul 2023 19:09:55 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=95=B0=E6=8D=AE=E8=BD=AC=E6=8D=A2=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/encrypt/interceptor/MybatisDecryptInterceptor.java | 3 ++- .../common/encrypt/interceptor/MybatisEncryptInterceptor.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisDecryptInterceptor.java b/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisDecryptInterceptor.java index 774da8d5..7c2508f8 100644 --- a/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisDecryptInterceptor.java +++ b/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisDecryptInterceptor.java @@ -1,6 +1,7 @@ package org.dromara.common.encrypt.interceptor; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ObjectUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -75,7 +76,7 @@ public class MybatisDecryptInterceptor implements Interceptor { Set fields = encryptorManager.getFieldCache(sourceObject.getClass()); try { for (Field field : fields) { - field.set(sourceObject, this.decryptField(String.valueOf(field.get(sourceObject)), field)); + field.set(sourceObject, this.decryptField(Convert.toStr(field.get(sourceObject)), field)); } } catch (Exception e) { log.error("处理解密字段时出错", e); diff --git a/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisEncryptInterceptor.java b/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisEncryptInterceptor.java index d16bc941..152f7db4 100644 --- a/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisEncryptInterceptor.java +++ b/ruoyi-common/ruoyi-common-encrypt/src/main/java/org/dromara/common/encrypt/interceptor/MybatisEncryptInterceptor.java @@ -1,6 +1,7 @@ package org.dromara.common.encrypt.interceptor; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ObjectUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -84,7 +85,7 @@ public class MybatisEncryptInterceptor implements Interceptor { Set fields = encryptorManager.getFieldCache(sourceObject.getClass()); try { for (Field field : fields) { - field.set(sourceObject, this.encryptField(String.valueOf(field.get(sourceObject)), field)); + field.set(sourceObject, this.encryptField(Convert.toStr(field.get(sourceObject)), field)); } } catch (Exception e) { log.error("处理加密字段时出错", e);