From 36f72056a9b692ffdc0a57acc0a20690a8b02de9 Mon Sep 17 00:00:00 2001 From: destroydestiny <49700906+destroydestiny@users.noreply.github.com> Date: Fri, 17 Nov 2023 21:32:22 +0800 Subject: [PATCH] [Bug] Fix TriggerRelationMapper cannot work due to miss DatabaseIdProvider (#15153) --- .../org/apache/dolphinscheduler/dao/DaoConfiguration.java | 8 ++++++++ .../dolphinscheduler/dao/mapper/TriggerRelationMapper.xml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoConfiguration.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoConfiguration.java index 2587bf0dc2..985f5b56b4 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoConfiguration.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoConfiguration.java @@ -24,6 +24,9 @@ import org.apache.dolphinscheduler.dao.plugin.api.DaoPluginConfiguration; import org.apache.dolphinscheduler.dao.plugin.api.dialect.DatabaseDialect; import org.apache.dolphinscheduler.dao.plugin.api.monitor.DatabaseMonitor; +import org.apache.ibatis.mapping.DatabaseIdProvider; +import org.apache.ibatis.mapping.VendorDatabaseIdProvider; + import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -61,6 +64,11 @@ public class DaoConfiguration { return interceptor; } + @Bean + public DatabaseIdProvider databaseIdProvider() { + return new VendorDatabaseIdProvider(); + } + @Bean public DbType dbType() { return daoPluginConfiguration.dbType(); diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TriggerRelationMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TriggerRelationMapper.xml index 3408af21e3..0cb90a768d 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TriggerRelationMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TriggerRelationMapper.xml @@ -53,7 +53,7 @@ ON DUPLICATE KEY UPDATE update_time = #{triggerRelation.updateTime}; - + INSERT INTO t_ds_trigger_relation (trigger_code, trigger_type, job_id, create_time, update_time) VALUES( #{triggerRelation.triggerCode},#{triggerRelation.triggerType},#{triggerRelation.jobId},#{triggerRelation.createTime},#{triggerRelation.updateTime}) ON CONFLICT(trigger_type,job_id,trigger_code) DO UPDATE SET update_time = #{triggerRelation.updateTime};