From e75208a8cbd9c40dea90446b39c84e9ee6f040f5 Mon Sep 17 00:00:00 2001 From: yitonglei Date: Fri, 1 Jul 2022 17:29:24 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=97=E8=A1=A8=E5=92=8C=E8=AF=A6=E6=83=85?= =?UTF-8?q?-TOP5=E4=BD=BF=E7=94=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV3.java | 12 ++++++++---- .../service/impl/ResourceServiceImpl.java | 2 +- .../resources/mapper/resource/ResourceDao.xml | 15 +++++++++------ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java index 6d204c1f..e552f0e0 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java @@ -234,10 +234,14 @@ public class CensusControllerV3 { @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") }) public Result>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map params){ - Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")}; - List> maps = jdbcTemplate.queryForList("SELECT b.name,count(a.id) AS useNum FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.reference_id = b.id \n" + - "inner join sys_user d on a.creator = d.id\n" + - "INNER JOIN sys_dept c ON d.dept_id = c.id WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?)) GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps); + Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")}; + List> maps = jdbcTemplate.queryForList("SELECT COUNT(c.id) as useNum,c.name FROM \n" + + "(\n" + + "\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" + + "\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" + + ") a \n" + + "INNER JOIN tb_data_resource_rel b ON a.id = b.key_id INNER JOIN tb_data_resource c ON b.reference_id = c.id\n" + + "WHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 GROUP BY c.name ORDER BY useNum desc limit 5", ps); return new Result>>().ok(maps); } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 75c11e50..7bef8b8e 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -1424,7 +1424,7 @@ public class ResourceServiceImpl extends CrudServiceImpl voidCompletableFuture02 = CompletableFuture.runAsync(() -> { maps.forEach(m -> { paraMap.put("id", m.get("deptId")); diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 9325b95a..e516a300 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1295,16 +1295,19 @@