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> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId> <artifactId>spring-cloud-bus</artifactId>
<version>4.1.2</version> <version>${spring.cloud.bus.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </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_name AS root_dept_name,
dept_id, dept_id,
dept_name dept_name
FROM dk_cloud.sys_dept FROM
dk_cloud.sys_dept
WHERE dept_id IN WHERE dept_id IN
<foreach collection="deptIdList" item="deptId" open="(" separator="," close=")"> <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
#{deptId} #{deptId}
@ -505,31 +506,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dt.root_dept_name, dt.root_dept_name,
d.dept_id, d.dept_id,
d.dept_name d.dept_name
FROM dk_cloud.sys_dept d FROM
JOIN warning_summary dt dk_cloud.sys_dept d
ON d.parent_id = dt.dept_id JOIN warning_summary dt ON d.parent_id = dt.dept_id
WHERE d.del_flag = '0' WHERE
d.del_flag = '0'
) )
SELECT SELECT
root_dept_name deptName, ws.root_dept_name AS deptName,
total IFNULL(COUNT(ba.id), 0) AS total
FROM ( FROM
SELECT warning_summary ws
dt.root_dept_id, LEFT JOIN business_alert ba ON ws.dept_id = ba.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
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') >= #{startTime} ]]>
and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]> and <![CDATA[ DATE_FORMAT(ba.create_time, '%Y-%m-%d') <= #{endTime} ]]>
<include refid="searchSql"></include> <include refid="searchSql"></include>
GROUP BY dt.root_dept_id,dt.root_dept_name GROUP BY
) dept_stats ws.root_dept_id,
ORDER BY total DESC ws.root_dept_name
LIMIT 5; ORDER BY
CASE WHEN total IS NULL THEN 1 ELSE 0 END,
total DESC
LIMIT 5
</select> </select>
<select id="listAlert" resultType="org.dromara.business.domain.BusinessAlert"> <select id="listAlert" resultType="org.dromara.business.domain.BusinessAlert">

2
pom.xml

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

Loading…
Cancel
Save