mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 10:35:57 +08:00
修复bug:当查询的列表为空时,解密方法报数组越界的异常
This commit is contained in:
parent
2e6a981edd
commit
d5ba003e48
@ -12,6 +12,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.executor.resultset.ResultSetHandler;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.Statement;
|
||||
@ -60,8 +61,12 @@ public class MybatisDecryptInterceptor implements Interceptor {
|
||||
return;
|
||||
}
|
||||
if (sourceObject instanceof List<?>) {
|
||||
List<?> sourceList = (List<?>) sourceObject;
|
||||
if(CollectionUtils.isEmpty(sourceList)) {
|
||||
return;
|
||||
}
|
||||
// 判断第一个元素是否含有注解。如果没有直接返回,提高效率
|
||||
Object firstItem = ((List<?>) sourceObject).get(0);
|
||||
Object firstItem = sourceList.get(0);
|
||||
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.PreparedStatement;
|
||||
@ -71,8 +72,12 @@ public class MybatisEncryptInterceptor implements Interceptor {
|
||||
return;
|
||||
}
|
||||
if (sourceObject instanceof List<?>) {
|
||||
List<?> sourceList = (List<?>) sourceObject;
|
||||
if(CollectionUtils.isEmpty(sourceList)) {
|
||||
return;
|
||||
}
|
||||
// 判断第一个元素是否含有注解。如果没有直接返回,提高效率
|
||||
Object firstItem = ((List<?>) sourceObject).get(0);
|
||||
Object firstItem = sourceList.get(0);
|
||||
if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user