diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisDecryptInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisDecryptInterceptor.java index abd02c3bc..0ea92b695 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisDecryptInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisDecryptInterceptor.java @@ -60,8 +60,12 @@ public class MybatisDecryptInterceptor implements Interceptor { return; } if (sourceObject instanceof List) { + List sourceList = (List) sourceObject; + if(CollectionUtil.isEmpty(sourceList)) { + return; + } // 判断第一个元素是否含有注解。如果没有直接返回,提高效率 - Object firstItem = ((List) sourceObject).get(0); + Object firstItem = sourceList.get(0); if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) { return; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisEncryptInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisEncryptInterceptor.java index 0907e089e..d8d549e49 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisEncryptInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/encrypt/MybatisEncryptInterceptor.java @@ -71,8 +71,12 @@ public class MybatisEncryptInterceptor implements Interceptor { return; } if (sourceObject instanceof List) { + List sourceList = (List) sourceObject; + if(CollectionUtil.isEmpty(sourceList)) { + return; + } // 判断第一个元素是否含有注解。如果没有直接返回,提高效率 - Object firstItem = ((List) sourceObject).get(0); + Object firstItem = sourceList.get(0); if (CollectionUtil.isEmpty(encryptorManager.getFieldCache(firstItem.getClass()))) { return; }