1、修改能力统计列表和详情-部分查询的条件限制

This commit is contained in:
yitonglei 2022-06-30 17:56:40 +08:00
parent 9d04ba4113
commit 274b11639f
2 changed files with 10 additions and 10 deletions

View File

@ -249,9 +249,9 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(d.id) as num,d.attr_value FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id INNER JOIN tb_data_attr d ON c.id = d.data_resource_id\n" +
"WHERE a.del_flag = 0 AND b.dept_id = ? AND c.type = ? AND d.attr_type = '组件类型' \n" +
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(d.id) as num,d.attr_value FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id INNER JOIN tb_data_attr d ON c.id = d.data_resource_id INNER JOIN sys_dept e ON b.dept_id = e.id\n" +
" WHERE a.del_flag = 0 AND (e.id = ? OR INSTR(e.pids,?)) AND c.type = ? AND d.attr_type = '组件类型' \n" +
"GROUP BY d.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
@ -297,10 +297,10 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select AVG(a.score) as score,b.name from tb_resource_score a inner join tb_data_resource b on a.resource_id = b.id\n" +
"inner join sys_user c on a.user_id = c.id \n" +
"where a.del_flag = 0 and b.type = ? and c.dept_id = ?\n" +
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT AVG(a.score) as score,b.name FROM tb_resource_score a INNER JOIN tb_data_resource b on a.resource_id = b.id\n" +
"INNER JOIN sys_dept c ON b.dept_id = c.id\n" +
"WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?))\n" +
"group by b.name order by score desc limit 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);

View File

@ -1076,9 +1076,9 @@
COUNT( tdav.data_resource_id ) AS total
FROM
( select a.* from tb_data_attr a inner join tb_data_resource d on a.data_resource_id = d.id
inner join tb_data_resource_rel e on e.reference_id = d.id inner join sys_user f on e.creator = f.id where
d.type=#{resourceType}
and f.dept_id = #{id}
inner join tb_data_resource_rel e on e.reference_id = d.id inner join sys_user f on e.creator = f.id
inner join sys_dept g on f.dept_id = g.id
where d.type=#{resourceType} and (g.id = #{id} OR instr(g.pids,#{id}))
) tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )