소스 검색

增加个判断.

聂秋秋 5 년 전
부모
커밋
1083669dee
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/executor/MybatisCachingExecutor.java

+ 4 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/executor/MybatisCachingExecutor.java

@@ -148,7 +148,10 @@ public class MybatisCachingExecutor implements Executor {
                         if (page.isSearchCount()) {
                             CacheKey cacheKey = getCountCacheKey(ms, boundSql, parameterObject, RowBounds.DEFAULT);
                             Number count = (Number) tcm.getObject(cache, cacheKey);
-                            return new PageList((List) result, count.longValue());
+                            // 正常的缓存操作来的话,这里是不会出现list有count没有的情况。
+                            if (count != null) {
+                                return new PageList((List) result, count.longValue());
+                            }
                         }
                         return new PageList((List) result, 0L);
                     } else {