Browse Source

[feat]

1、增加公共spring-cloud-bus配置
2、修改预警统计sql
master
杨威 3 months ago
parent
commit
6d5671719e
  1. 2
      dk-common/common-bus/pom.xml
  2. 40
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml
  3. 2
      pom.xml

2
dk-common/common-bus/pom.xml

@ -34,7 +34,7 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
<version>4.1.2</version>
<version>${spring.cloud.bus.version}</version>
</dependency>
</dependencies>
</project>

40
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
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
#{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 <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]>
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]>
<include refid="searchSql"></include>
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
</select>
<select id="listAlert" resultType="org.dromara.business.domain.BusinessAlert">

2
pom.xml

@ -78,6 +78,8 @@
<geotools.version>23.2</geotools.version>
<!--PostgreSQL配置-->
<postgresql.version>42.6.2</postgresql.version>
<spring.cloud.bus.version>4.1.2</spring.cloud.bus.version>
</properties>
<profiles>

Loading…
Cancel
Save