全局数量排序

This commit is contained in:
wangliwen 2022-11-01 11:30:57 +08:00
parent f25d4b1d56
commit cca87f9fbd
2 changed files with 33 additions and 12 deletions

View File

@ -2026,6 +2026,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
{ {
put("count", null == dataResource ? "0" : dataResource.get("rows") + ""); put("count", null == dataResource ? "0" : dataResource.get("rows") + "");
put("type", "数据资源"); put("type", "数据资源");
put("type_index", 4);
} }
}); });
}, executor); }, executor);
@ -2038,6 +2039,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
{ {
put("count", countNew + ""); put("count", countNew + "");
put("type", "基础设施"); put("type", "基础设施");
put("type_index", 3);
} }
}); });
@ -2073,7 +2075,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}; };
resultList.add(nullMap); resultList.add(nullMap);
}); });
return resultList; return resultList.stream().sorted(Comparator.comparing(x -> {
Map index = (Map) x;
int type_index = index.containsKey("type_index") ? (int) index.get("type_index") : Integer.MAX_VALUE;
return type_index;
}).reversed()).collect(Collectors.toList());
} }
@Override @Override

View File

@ -1639,7 +1639,22 @@
<select id="selectTypeCountByName" resultType="java.util.Map"> <select id="selectTypeCountByName" resultType="java.util.Map">
SELECT SELECT
type, type,
count(id) AS "count" count(id) AS "count",
(
CASE
type
WHEN '应用资源' THEN
1
WHEN '组件服务' THEN
2
WHEN '基础设施' THEN
3
WHEN '知识库' THEN
5
WHEN '数据资源' THEN
4
END
) AS "type_index"
FROM tb_data_resource FROM tb_data_resource
WHERE 1 = 1 WHERE 1 = 1
AND del_flag = 0 AND del_flag = 0
@ -2272,18 +2287,18 @@
<select id="getAppListByDept" resultType="java.util.Map"> <select id="getAppListByDept" resultType="java.util.Map">
SELECT SELECT
tdr.id, tdr.id,
tdr.NAME, tdr.NAME,
tdr.create_date tdr.create_date
FROM FROM
tb_data_resource tdr tb_data_resource tdr
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0
AND tdr.dept_id = #{deptId} AND tdr.dept_id = #{deptId}
<if test="key != null and key != ''"> <if test="key != null and key != ''">
AND tdr.name like CONCAT('%', #{key}, '%') AND tdr.name like CONCAT('%', #{key}, '%')
</if> </if>
ORDER BY create_date DESC ORDER BY create_date DESC
</select> </select>