门户搜索修改

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();
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<>();
resourceMap.put("type", "全部能力目录");
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("dataList", resourceDao.selectList(queryWrapper));
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()
.collect(Collectors.groupingBy(m -> m.get("type").toString()));
listMap.entrySet().stream().forEach(item -> {
HashMap<Object, Object> map = new HashMap<>();
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());
resultList.add(map);
});

View File

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