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 da25be2e7..8b50c0579 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 26ef776a8..2ed968db3 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 baeb22421..8e4a5fcbe 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 f22ab4086..0e8525839 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 7af83ece6..3d260b562 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 9075b7ca8..e3ddbbedb 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 + +