fix 修复 加解密拦截器 对象属性为null问题
This commit is contained in:
parent
d8b264a13d
commit
11f548b53b
@ -76,7 +76,12 @@ public class MybatisDecryptInterceptor implements Interceptor {
|
||||
Set<Field> fields = encryptorManager.getFieldCache(sourceObject.getClass());
|
||||
try {
|
||||
for (Field field : fields) {
|
||||
field.set(sourceObject, this.decryptField(String.valueOf(field.get(sourceObject)), field));
|
||||
// 防止对象不是null 属性内容是null
|
||||
Object obj = field.get(sourceObject);
|
||||
if (ObjectUtil.isNull(obj)) {
|
||||
continue;
|
||||
}
|
||||
field.set(sourceObject, this.decryptField(String.valueOf(field.get(obj)), field));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理解密字段时出错", e);
|
||||
|
@ -86,7 +86,12 @@ public class MybatisEncryptInterceptor implements Interceptor {
|
||||
Set<Field> fields = encryptorManager.getFieldCache(sourceObject.getClass());
|
||||
try {
|
||||
for (Field field : fields) {
|
||||
field.set(sourceObject, this.encryptField(String.valueOf(field.get(sourceObject)), field));
|
||||
// 防止对象不是null 属性内容是null
|
||||
Object obj = field.get(sourceObject);
|
||||
if (ObjectUtil.isNull(obj)) {
|
||||
continue;
|
||||
}
|
||||
field.set(sourceObject, this.encryptField(String.valueOf(field.get(obj)), field));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理加密字段时出错", e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user