1、修改能力统计列表和详情-TOP5使用组件

This commit is contained in:
yitonglei 2022-07-01 17:29:24 +08:00
parent ff808b022b
commit e75208a8cb
3 changed files with 18 additions and 11 deletions

View File

@ -234,10 +234,14 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
List<Map<String, Object>> 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<Map<String, Object>> 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<List<Map<String,Object>>>().ok(maps);
}

View File

@ -1424,7 +1424,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
});
});
//这里的使用数应该就是调用数先用这个等查询调用数的接口开发完了再改2020/07/01 ytl
//本部门的应用关联的组件数量
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> {
paraMap.put("id", m.get("deptId"));

View File

@ -1295,16 +1295,19 @@
<!-- 根据组件类型查询部门申请组件的数量-->
<select id="assemblyCarByDept" parameterType="java.util.Map" resultType="java.util.Map">
SELECT COUNT(distinct(a.resource_id)) as carNum,c.id FROM tb_resource_car a INNER JOIN sys_user b ON a.creator =
b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.resource_id = d.id
WHERE a.del_flag = 0 AND c.id =#{id} AND d.type = #{resourceType} group by c.id
SELECT COUNT(a.id) as carNum FROM tb_resource_car a INNER JOIN sys_user b ON a.user_id = b.id INNER JOIN sys_dept c
ON b.dept_id = c.id INNER JOIN tb_data_resource d ON a.resource_id = d.id
WHERE a.del_flag = 0 AND (c.id = #{id} OR INSTR(c.pids,#{id})) AND d.type = #{resourceType} AND d.del_flag = 0
</select>
<!--根据组件类型查询部门使用组件的数量-->
<select id="assemblyUseByDept" parameterType="java.util.Map" resultType="java.util.Map">
SELECT COUNT(distinct(a.key_id)) as useNum,c.id FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator =
b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.key_id = d.id
WHERE a.del_flag = 0 AND d.type = #{resourceType} AND c.id = #{id} group by c.id
SELECT COUNT(DISTINCT(b.reference_id)) AS useNum FROM
(
SELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
WHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = #{id} OR INSTR(b.pids,#{id}))
) a
INNER JOIN tb_data_resource_rel b ON a.id = b.key_id WHERE b.del_flag = 0
</select>
<select id="selectCountByDepts" resultType="java.util.Map">