From f185f943dee4e7e34177eb9ff2b26da2c29bb50a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 24 Jun 2022 17:40:56 +0800 Subject: [PATCH] npe --- .../java/io/renren/common/controller/CensusControllerV2.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index c0658802..9495a5e3 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -292,7 +292,7 @@ public class CensusControllerV2 { }); }); CompletableFuture allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量 - return jdbcTemplate.queryForObject("SELECT SUM(visits) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); + return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); }).thenAccept(sum -> { result.add(new HashMap() { { @@ -434,7 +434,7 @@ public class CensusControllerV2 { List lists = JSON.parseArray(ja, Map.class); ArrayList list = new ArrayList<>(); lists.forEach(item -> { - list.add(new HashMap(){{ + list.add(new HashMap() {{ put("服务名称", item.get("zyname")); put("申请次数", item.get("syqk")); }});