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 c47d96ba..cba530d1 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 @@ -249,9 +249,9 @@ public class CensusControllerV3 { @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") }) public Result>> assemblerUseInfo(@ApiIgnore @RequestParam Map params){ - Object[] ps = {params.get("id"),params.get("resourceType")}; - List> 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> 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>>().ok(maps); @@ -297,10 +297,10 @@ public class CensusControllerV3 { @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") }) public Result>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map params){ - Object[] ps = {params.get("resourceType"),params.get("id")}; - List> 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> 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>>().ok(maps); diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index eefc166a..c04c3117 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -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 < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, ';', '' ) ) + 1 )