From cdc6cd1bba85d08a0ff47a368c1f4904c07a4d20 Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期二, 19 八月 2025 20:21:08 +0800 Subject: [PATCH] 用户修改个人信息时 报错 --- zhang-content/src/main/java/com/ruoyi/service/impl/EsServiceImpl.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/EsServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/EsServiceImpl.java index 6fcfd37..7ed3c3b 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/EsServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/EsServiceImpl.java @@ -121,7 +121,11 @@ .withQuery(boolQueryBuilder); NativeSearchQuery nativeSearchQuery = nativeSearchQueryBuilder.build(); - return Objects.requireNonNull(elasticsearchRestTemplate.searchOne(nativeSearchQuery, EsModel.class)).getContent(); + SearchHit<EsModel> esModelSearchHit = elasticsearchRestTemplate.searchOne(nativeSearchQuery, EsModel.class); + if(esModelSearchHit != null){ + return esModelSearchHit.getContent(); + } + return null; } -- Gitblit v1.9.1