sql修改

This commit is contained in:
dinggang 2022-06-19 18:41:07 +08:00
parent 64398d8926
commit e090c4fd8a
1 changed files with 9 additions and 12 deletions

View File

@ -897,20 +897,18 @@
SELECT SELECT
tdr.id AS "resourceId", tdr.id AS "resourceId",
tdr.NAME AS "name", tdr.NAME AS "name",
COUNT( taa.id ) AS "applyCount" IFNULL(COUNT( taa.id ), 0) AS "count"
FROM FROM
tb_data_resource tdr, tb_data_resource tdr
t_ability_application taa LEFT JOIN t_ability_application taa ON tdr.id = taa.resource_id AND taa.del_flag = 0
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0
AND taa.del_flag = 0
AND tdr.id = taa.resource_id
AND tdr.type = '组件服务' AND tdr.type = '组件服务'
GROUP BY GROUP BY
tdr.id tdr.id
ORDER BY ORDER BY
applyCount DESC count DESC
LIMIT 5 LIMIT 5
</select> </select>
@ -918,15 +916,14 @@
SELECT SELECT
tdr.id AS "resourceId", tdr.id AS "resourceId",
tdr.NAME AS "name", tdr.NAME AS "name",
SUM(trs.score) AS "score" IFNULL( SUM( trs.score ), 0 ) AS "score"
FROM FROM
tb_data_resource tdr, tb_data_resource tdr
tb_resource_score trs LEFT JOIN tb_resource_score trs ON tdr.id = trs.resource_id
AND trs.del_flag = 0
WHERE WHERE
1 = 1 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0
AND trs.del_flag = 0
AND tdr.id = trs.resource_id
AND tdr.type = '组件服务' AND tdr.type = '组件服务'
GROUP BY GROUP BY
tdr.id tdr.id