门户搜索修改

This commit is contained in:
dinggang 2022-05-11 20:52:48 +08:00
parent ba2cf96791
commit 939864d0f6
3 changed files with 29 additions and 29 deletions

View File

@ -53,7 +53,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
*/ */
Long countAllDept(); Long countAllDept();
List<Map<String, Object>> selectGroupByDeptId(); List<Map<String, Object>> selectGroupByDeptId(@Param("type") String type);
Integer selectTypeCountByDept(String type); Integer selectTypeCountByDept(@Param("deptType") String deptType, @Param("resourceType") String resourceType);
} }

View File

@ -289,17 +289,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>(); HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录"); resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", 0); queryWrapper.eq("del_flag", 0).eq("type", jsonObject.getString("type"));
resourceMap.put("total", resourceDao.selectCount(queryWrapper)); resourceMap.put("total", resourceDao.selectCount(queryWrapper));
//resourceMap.put("dataList", resourceDao.selectList(queryWrapper)); //resourceMap.put("dataList", resourceDao.selectList(queryWrapper));
resultList.add(resourceMap); resultList.add(resourceMap);
List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId(); List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId(jsonObject.getString("type"));
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream() Map<String, List<Map<String, Object>>> listMap = typeMapList.stream()
.collect(Collectors.groupingBy(m -> m.get("type").toString())); .collect(Collectors.groupingBy(m -> m.get("type").toString()));
listMap.entrySet().stream().forEach(item -> { listMap.entrySet().stream().forEach(item -> {
HashMap<Object, Object> map = new HashMap<>(); HashMap<Object, Object> map = new HashMap<>();
map.put("type", item.getKey()); map.put("type", item.getKey());
map.put("total", resourceDao.selectTypeCountByDept(item.getKey())); map.put("total", resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type")));
map.put("dataList", item.getValue()); map.put("dataList", item.getValue());
resultList.add(map); resultList.add(map);
}); });

View File

@ -321,14 +321,14 @@
* *
FROM FROM
( (
SELECT SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type", ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
sd.NAME AS "deptName", sd.NAME AS "deptName",
IFNULL( tdr.deptCount, 0 ) AS "deptCount", IFNULL( tdr.deptCount, 0 ) AS "deptCount",
sd.id AS "deptId" sd.id AS "deptId"
FROM FROM
sys_dept sd sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND type = #{type} GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
) temp1 ) temp1
WHERE WHERE
1 = 1 1 = 1
@ -340,24 +340,24 @@
SUM( deptCount ) SUM( deptCount )
FROM FROM
( (
SELECT SELECT
* *
FROM FROM
( (
SELECT SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type", ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
sd.NAME AS "deptName", sd.NAME AS "deptName",
IFNULL( tdr.deptCount, 0 ) AS "deptCount" IFNULL( tdr.deptCount, 0 ) AS "deptCount"
FROM FROM
sys_dept sd sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND type = #{resourceType} GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
) temp1 ) temp1
WHERE WHERE
1 = 1 1 = 1
AND temp1.deptCount != 0 AND temp1.deptCount != 0
) temp2 ) temp2
WHERE 1 = 1 WHERE 1 = 1
AND temp2.type = #{type} AND temp2.type = #{deptType}
GROUP BY GROUP BY
temp2.type temp2.type
</select> </select>