From f0356cc5f0538473c778c881ec54d0785fce1a2d Mon Sep 17 00:00:00 2001 From: dhb52 Date: Sun, 21 Jul 2024 01:10:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(sj=5F1.2.0-beta1):=20SnailJobMybatisConfigu?= =?UTF-8?q?ration=20=E8=A1=A5=E9=BD=90=20DUPLICATE=5FIDS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/SnailJobMybatisConfiguration.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/handler/SnailJobMybatisConfiguration.java b/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/handler/SnailJobMybatisConfiguration.java index 537f7bbc7..a414a79e7 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/handler/SnailJobMybatisConfiguration.java +++ b/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/handler/SnailJobMybatisConfiguration.java @@ -1,11 +1,6 @@ package com.aizuda.snailjob.template.datasource.handler; -import com.aizuda.snailjob.template.datasource.persistence.mapper.JobLogMessageMapper; -import com.aizuda.snailjob.template.datasource.persistence.mapper.JobSummaryMapper; -import com.aizuda.snailjob.template.datasource.persistence.mapper.RetrySummaryMapper; -import com.aizuda.snailjob.template.datasource.persistence.mapper.RetryTaskLogMapper; -import com.aizuda.snailjob.template.datasource.persistence.mapper.RetryTaskLogMessageMapper; -import com.aizuda.snailjob.template.datasource.persistence.mapper.RetryTaskMapper; +import com.aizuda.snailjob.template.datasource.persistence.mapper.*; import com.baomidou.mybatisplus.core.MybatisConfiguration; import org.apache.ibatis.mapping.MappedStatement; @@ -25,17 +20,22 @@ public class SnailJobMybatisConfiguration extends MybatisConfiguration { */ static final Set DUPLICATE_IDS = new HashSet<>(); + private static final String BATCH_INSERT_ID = "insertBatch"; + static { - DUPLICATE_IDS.add(JobSummaryMapper.class.getName() + ".insertBatch"); - DUPLICATE_IDS.add(RetryTaskLogMapper.class.getName() + ".insertBatch"); - DUPLICATE_IDS.add(RetrySummaryMapper.class.getName() + ".insertBatch"); - DUPLICATE_IDS.add(RetryTaskLogMessageMapper.class.getName() + ".insertBatch"); - DUPLICATE_IDS.add(RetryTaskMapper.class.getName() + ".insertBatch"); - DUPLICATE_IDS.add(JobLogMessageMapper.class.getName() + ".insertBatch"); + DUPLICATE_IDS.add(RetryDeadLetterMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(ServerNodeMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(JobTaskMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(JobSummaryMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(RetryTaskLogMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(RetrySummaryMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(RetryTaskLogMessageMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(RetryTaskMapper.class.getName() + "." + BATCH_INSERT_ID); + DUPLICATE_IDS.add(JobLogMessageMapper.class.getName() + "." + BATCH_INSERT_ID); } @Override - public void addMappedStatement(final MappedStatement ms) { + public void addMappedStatement(MappedStatement ms) { if (mappedStatements.containsKey(ms.getId())) { if (!DUPLICATE_IDS.contains(ms.getId())) { super.addMappedStatement(ms);