This is an automated email from the ASF dual-hosted git repository.

xiatian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/eventmesh-dashboard.git


The following commit(s) were added to refs/heads/dev by this push:
     new e750702  [ISSUE #67] Fix HealthCheckResultMapper which leads to 
application error
e750702 is described below

commit e750702966ed3e17b8eed4300ad75f40d19a3383
Author: Lambert Rao <[email protected]>
AuthorDate: Tue Mar 19 15:46:27 2024 +0800

    [ISSUE #67] Fix HealthCheckResultMapper which leads to application error
---
 .../console/mapper/health/HealthCheckResultMapper.java  | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java
index 01930c5..519605b 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java
@@ -58,11 +58,18 @@ public interface HealthCheckResultMapper {
 
     @Insert({
         "<script>",
-        "   INSERT INTO health_check_result(type, type_id, cluster_id, state, 
result_desc) VALUES ",
-        "   <foreach collection='list' item='healthCheckResultEntity' 
index='index' separator=','>",
-        "       (#{healthCheckResultEntity.type}, 
#{healthCheckResultEntity.typeId}, #{healthCheckResultEntity.clusterId},",
-        "       #{healthCheckResultEntity.state}, 
#{healthCheckResultEntity.resultDesc})",
-        "   </foreach>",
+        "   <choose>",
+        "   <when test='list.size() > 0'>",
+        "       INSERT INTO health_check_result(type, type_id, cluster_id, 
state, result_desc) VALUES ",
+        "       <foreach collection='list' item='healthCheckResultEntity' 
index='index' separator=','>",
+        "           (#{healthCheckResultEntity.type}, 
#{healthCheckResultEntity.typeId}, #{healthCheckResultEntity.clusterId},",
+        "           #{healthCheckResultEntity.state}, 
#{healthCheckResultEntity.resultDesc})",
+        "       </foreach>",
+        "   </when>",
+        "   <otherwise>",
+        "       SELECT 1 FROM DUAL WHERE FALSE",
+        "   </otherwise>",
+        "   </choose>",
         "</script>"
     })
     void batchInsert(List<HealthCheckResultEntity> 
healthCheckResultEntityList);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to