From cfc544e35b567763e8704420e9a08f5c63c930ca Mon Sep 17 00:00:00 2001 From: dhb52 Date: Thu, 18 Jul 2024 14:52:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(sj=5F1.1.1):=20=E6=89=B9=E9=87=8F=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E9=9C=80=E8=A6=81=E4=BD=BF=E7=94=A8isOracle/notOracle?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/datasource/utils/DbUtils.java | 7 +++ .../template/mapper/JobLogMessageMapper.xml | 19 ++++++- .../template/mapper/JobSummaryMapper.xml | 54 +++++++++++++------ .../template/mapper/RetryDeadLetterMapper.xml | 23 ++++++-- .../template/mapper/RetrySummaryMapper.xml | 43 ++++++++++----- .../template/mapper/RetryTaskLogMapper.xml | 27 +++++++--- .../mapper/RetryTaskLogMessageMapper.xml | 23 ++++++-- .../template/mapper/RetryTaskMapper.xml | 21 ++++++++ .../template/mapper/ServerNodeMapper.xml | 43 ++++++++++----- 9 files changed, 201 insertions(+), 59 deletions(-) diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/utils/DbUtils.java b/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/utils/DbUtils.java index da25be2e..8b50c057 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/utils/DbUtils.java +++ b/snail-job-datasource/snail-job-datasource-template/src/main/java/com/aizuda/snailjob/template/datasource/utils/DbUtils.java @@ -18,4 +18,11 @@ public class DbUtils { return DbTypeEnum.modeOf(url); } + public static boolean isOracle() { + return DbTypeEnum.ORACLE.equals(getDbType()); + } + + public static boolean notOracle() { + return !DbTypeEnum.ORACLE.equals(getDbType()); + } } diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobLogMessageMapper.xml b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobLogMessageMapper.xml index 26ef776a..2ed968db 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobLogMessageMapper.xml +++ b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobLogMessageMapper.xml @@ -5,7 +5,8 @@ INSERT INTO sj_job_log_message (namespace_id, group_name, job_id, task_batch_id, task_id, log_num, message, create_dt, real_time) - VALUES + + VALUES ( #{item.namespaceId}, @@ -19,6 +20,22 @@ #{item.realTime} ) + + + + SELECT + #{item.namespaceId}, + #{item.groupName}, + #{item.jobId}, + #{item.taskBatchId}, + #{item.taskId}, + #{item.logNum}, + #{item.message}, + #{item.createDt}, + #{item.realTime} + FROM DUAL + + diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobSummaryMapper.xml b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobSummaryMapper.xml index baeb2242..8e4a5fcb 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobSummaryMapper.xml +++ b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/JobSummaryMapper.xml @@ -5,23 +5,43 @@ INSERT INTO sj_job_summary (namespace_id, group_name, business_id, trigger_at, system_task_type, success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason) - VALUES - - ( - #{item.namespaceId}, - #{item.groupName}, - #{item.businessId}, - #{item.triggerAt}, - #{item.systemTaskType}, - #{item.successNum}, - #{item.failNum}, - #{item.failReason}, - #{item.stopNum}, - #{item.stopReason}, - #{item.cancelNum}, - #{item.cancelReason} - ) - + + VALUES + + ( + #{item.namespaceId}, + #{item.groupName}, + #{item.businessId}, + #{item.triggerAt}, + #{item.systemTaskType}, + #{item.successNum}, + #{item.failNum}, + #{item.failReason}, + #{item.stopNum}, + #{item.stopReason}, + #{item.cancelNum}, + #{item.cancelReason} + ) + + + + + SELECT + #{item.namespaceId}, + #{item.groupName}, + #{item.businessId}, + #{item.triggerAt}, + #{item.systemTaskType}, + #{item.successNum}, + #{item.failNum}, + #{item.failReason}, + #{item.stopNum}, + #{item.stopReason}, + #{item.cancelNum}, + #{item.cancelReason} + FROM DUAL + + INSERT INTO sj_retry_task_log (unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, task_type, create_dt, namespace_id) - VALUES - - ( - #{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId}, - #{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs}, - #{item.taskType}, #{item.createDt}, #{item.namespaceId} - ) - + + VALUES + + ( + #{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId}, + #{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs}, + #{item.taskType}, #{item.createDt}, #{item.namespaceId} + ) + + + + + SELECT + #{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId}, + #{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs}, + #{item.taskType}, #{item.createDt}, #{item.namespaceId} + FROM DUAL + + diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskLogMessageMapper.xml b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskLogMessageMapper.xml index f22ab408..0e852583 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskLogMessageMapper.xml +++ b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskLogMessageMapper.xml @@ -5,9 +5,23 @@ INSERT INTO sj_retry_task_log_message (namespace_id, group_name, unique_id, log_num, message, create_dt, real_time) - VALUES - - ( + + VALUES + + ( + #{item.namespaceId}, + #{item.groupName}, + #{item.uniqueId}, + #{item.logNum}, + #{item.message}, + #{item.createDt}, + #{item.realTime} + ) + + + + + SELECT #{item.namespaceId}, #{item.groupName}, #{item.uniqueId}, @@ -15,8 +29,9 @@ #{item.message}, #{item.createDt}, #{item.realTime} - ) + FROM DUAL + diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskMapper.xml b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskMapper.xml index 7af83ece..3d260b56 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskMapper.xml +++ b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/RetryTaskMapper.xml @@ -6,6 +6,7 @@ INSERT INTO sj_retry_task (namespace_id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, next_trigger_at, task_type, retry_status, create_dt) + VALUES ( @@ -24,6 +25,26 @@ #{item.createDt} ) + + + + SELECT + #{item.namespaceId}, + #{item.uniqueId}, + #{item.groupName}, + #{item.sceneName}, + #{item.idempotentId}, + #{item.bizNo}, + #{item.executorName}, + #{item.argsStr}, + #{item.extAttrs}, + #{item.nextTriggerAt}, + #{item.taskType}, + #{item.retryStatus}, + #{item.createDt} + FROM DUAL + + diff --git a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/ServerNodeMapper.xml b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/ServerNodeMapper.xml index 9075b7ca..e3ddbbed 100644 --- a/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/ServerNodeMapper.xml +++ b/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/ServerNodeMapper.xml @@ -6,19 +6,36 @@ INSERT INTO sj_server_node (namespace_id, group_name, host_id, host_ip, host_port, expire_at, node_type, ext_attrs, create_dt) VALUES - - ( - #{item.namespaceId,jdbcType=VARCHAR}, - #{item.groupName,jdbcType=VARCHAR}, - #{item.hostId,jdbcType=VARCHAR}, - #{item.hostIp,jdbcType=VARCHAR}, - #{item.hostPort,jdbcType=INTEGER}, - #{item.expireAt,jdbcType=TIMESTAMP}, - #{item.nodeType,jdbcType=TINYINT}, - #{item.extAttrs,jdbcType=VARCHAR}, - #{item.createDt,jdbcType=TIMESTAMP} - ) - + + + ( + #{item.namespaceId,jdbcType=VARCHAR}, + #{item.groupName,jdbcType=VARCHAR}, + #{item.hostId,jdbcType=VARCHAR}, + #{item.hostIp,jdbcType=VARCHAR}, + #{item.hostPort,jdbcType=INTEGER}, + #{item.expireAt,jdbcType=TIMESTAMP}, + #{item.nodeType,jdbcType=TINYINT}, + #{item.extAttrs,jdbcType=VARCHAR}, + #{item.createDt,jdbcType=TIMESTAMP} + ) + + + + + SELECT + #{item.namespaceId,jdbcType=VARCHAR}, + #{item.groupName,jdbcType=VARCHAR}, + #{item.hostId,jdbcType=VARCHAR}, + #{item.hostIp,jdbcType=VARCHAR}, + #{item.hostPort,jdbcType=INTEGER}, + #{item.expireAt,jdbcType=TIMESTAMP}, + #{item.nodeType,jdbcType=TINYINT}, + #{item.extAttrs,jdbcType=VARCHAR}, + #{item.createDt,jdbcType=TIMESTAMP} + FROM DUAL + +