From 6d5671719ea43dbbb9ddb25a6dd7613c80eb1c22 Mon Sep 17 00:00:00 2001 From: yangwei <867012372@qq.com> Date: Mon, 31 Mar 2025 14:33:17 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=201=E3=80=81=E5=A2=9E=E5=8A=A0=E5=85=AC?= =?UTF-8?q?=E5=85=B1spring-cloud-bus=E9=85=8D=E7=BD=AE=202=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E8=AD=A6=E7=BB=9F=E8=AE=A1sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dk-common/common-bus/pom.xml | 2 +- .../mapper/business/BusinessAlertMapper.xml | 40 +++++++++---------- pom.xml | 2 + 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dk-common/common-bus/pom.xml b/dk-common/common-bus/pom.xml index c0cfdf8..5d12802 100644 --- a/dk-common/common-bus/pom.xml +++ b/dk-common/common-bus/pom.xml @@ -34,7 +34,7 @@ org.springframework.cloud spring-cloud-bus - 4.1.2 + ${spring.cloud.bus.version} diff --git a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml index b73248b..b32d8c9 100644 --- a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml @@ -494,7 +494,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dept_name AS root_dept_name, dept_id, dept_name - FROM dk_cloud.sys_dept + FROM + dk_cloud.sys_dept WHERE dept_id IN #{deptId} @@ -505,31 +506,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dt.root_dept_name, d.dept_id, d.dept_name - FROM dk_cloud.sys_dept d - JOIN warning_summary dt - ON d.parent_id = dt.dept_id - WHERE d.del_flag = '0' + FROM + dk_cloud.sys_dept d + JOIN warning_summary dt ON d.parent_id = dt.dept_id + WHERE + d.del_flag = '0' ) SELECT - root_dept_name deptName, - total - FROM ( - SELECT - dt.root_dept_id, - dt.root_dept_name, - COUNT(ba.id) total - FROM business_alert ba - JOIN warning_summary dt - ON ba.dept_id = dt.dept_id - WHERE - 1=1 + ws.root_dept_name AS deptName, + IFNULL(COUNT(ba.id), 0) AS total + FROM + warning_summary ws + LEFT JOIN business_alert ba ON ws.dept_id = ba.dept_id and = #{startTime} ]]> and - GROUP BY dt.root_dept_id,dt.root_dept_name - ) dept_stats - ORDER BY total DESC - LIMIT 5; + GROUP BY + ws.root_dept_id, + ws.root_dept_name + ORDER BY + CASE WHEN total IS NULL THEN 1 ELSE 0 END, + total DESC + LIMIT 5