fix(sj_1.1.1): 批量插入需要使用isOracle/notOracle进行区分
This commit is contained in:
parent
158f22f674
commit
cfc544e35b
@ -18,4 +18,11 @@ public class DbUtils {
|
|||||||
return DbTypeEnum.modeOf(url);
|
return DbTypeEnum.modeOf(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isOracle() {
|
||||||
|
return DbTypeEnum.ORACLE.equals(getDbType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean notOracle() {
|
||||||
|
return !DbTypeEnum.ORACLE.equals(getDbType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
||||||
INSERT INTO sj_job_log_message (namespace_id, group_name, job_id, task_batch_id, task_id,
|
INSERT INTO sj_job_log_message (namespace_id, group_name, job_id, task_batch_id, task_id,
|
||||||
log_num, message, create_dt, real_time)
|
log_num, message, create_dt, real_time)
|
||||||
VALUES
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.namespaceId},
|
#{item.namespaceId},
|
||||||
@ -19,6 +20,22 @@
|
|||||||
#{item.realTime}
|
#{item.realTime}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="list" item="item" separator="UNION ALL">
|
||||||
|
SELECT
|
||||||
|
#{item.namespaceId},
|
||||||
|
#{item.groupName},
|
||||||
|
#{item.jobId},
|
||||||
|
#{item.taskBatchId},
|
||||||
|
#{item.taskId},
|
||||||
|
#{item.logNum},
|
||||||
|
#{item.message},
|
||||||
|
#{item.createDt},
|
||||||
|
#{item.realTime}
|
||||||
|
FROM DUAL
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -5,23 +5,43 @@
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
||||||
INSERT INTO sj_job_summary (namespace_id, group_name, business_id, trigger_at, system_task_type,
|
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)
|
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
|
||||||
VALUES
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
<foreach collection="list" item="item" separator=",">
|
VALUES
|
||||||
(
|
<foreach collection="list" item="item" separator=",">
|
||||||
#{item.namespaceId},
|
(
|
||||||
#{item.groupName},
|
#{item.namespaceId},
|
||||||
#{item.businessId},
|
#{item.groupName},
|
||||||
#{item.triggerAt},
|
#{item.businessId},
|
||||||
#{item.systemTaskType},
|
#{item.triggerAt},
|
||||||
#{item.successNum},
|
#{item.systemTaskType},
|
||||||
#{item.failNum},
|
#{item.successNum},
|
||||||
#{item.failReason},
|
#{item.failNum},
|
||||||
#{item.stopNum},
|
#{item.failReason},
|
||||||
#{item.stopReason},
|
#{item.stopNum},
|
||||||
#{item.cancelNum},
|
#{item.stopReason},
|
||||||
#{item.cancelReason}
|
#{item.cancelNum},
|
||||||
)
|
#{item.cancelReason}
|
||||||
</foreach>
|
)
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="list" item="item" separator="UNION ALL">
|
||||||
|
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
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectJobTaskList"
|
<select id="selectJobTaskList"
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
||||||
INSERT INTO sj_retry_dead_letter (namespace_id, unique_id, group_name, scene_name,
|
INSERT INTO sj_retry_dead_letter (namespace_id, unique_id, group_name, scene_name,
|
||||||
idempotent_id, biz_no, executor_name, args_str,
|
idempotent_id, biz_no, executor_name, args_str,
|
||||||
ext_attrs, create_dt
|
ext_attrs, create_dt)
|
||||||
)
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.namespaceId,jdbcType=VARCHAR},
|
#{item.namespaceId,jdbcType=VARCHAR},
|
||||||
@ -22,6 +22,23 @@
|
|||||||
#{item.createDt,jdbcType=TIMESTAMP}
|
#{item.createDt,jdbcType=TIMESTAMP}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="retryDeadLetters" item="retryDeadLetter" separator="UNION ALL">
|
||||||
|
SELECT
|
||||||
|
#{item.namespaceId,jdbcType=VARCHAR},
|
||||||
|
#{item.uniqueId,jdbcType=VARCHAR},
|
||||||
|
#{item.groupName,jdbcType=VARCHAR},
|
||||||
|
#{item.sceneName,jdbcType=VARCHAR},
|
||||||
|
#{item.idempotentId,jdbcType=VARCHAR},
|
||||||
|
#{item.bizNo,jdbcType=VARCHAR},
|
||||||
|
#{item.executorName,jdbcType=VARCHAR},
|
||||||
|
#{item.argsStr,jdbcType=VARCHAR},
|
||||||
|
#{item.extAttrs,jdbcType=VARCHAR},
|
||||||
|
#{item.createDt,jdbcType=TIMESTAMP}
|
||||||
|
FROM DUAL
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -5,19 +5,36 @@
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
||||||
INSERT INTO sj_retry_summary (namespace_id, group_name, scene_name, trigger_at,
|
INSERT INTO sj_retry_summary (namespace_id, group_name, scene_name, trigger_at,
|
||||||
running_num, finish_num, max_count_num, suspend_num)
|
running_num, finish_num, max_count_num, suspend_num)
|
||||||
VALUES
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
<foreach collection="list" item="item" separator=",">
|
VALUES
|
||||||
(
|
<foreach collection="list" item="item" separator=",">
|
||||||
#{item.namespaceId},
|
(
|
||||||
#{item.groupName},
|
#{item.namespaceId},
|
||||||
#{item.sceneName},
|
#{item.groupName},
|
||||||
#{item.triggerAt},
|
#{item.sceneName},
|
||||||
#{item.runningNum},
|
#{item.triggerAt},
|
||||||
#{item.finishNum},
|
#{item.runningNum},
|
||||||
#{item.maxCountNum},
|
#{item.finishNum},
|
||||||
#{item.suspendNum}
|
#{item.maxCountNum},
|
||||||
)
|
#{item.suspendNum}
|
||||||
</foreach>
|
)
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="list" item="item" separator="UNION ALL">
|
||||||
|
SELECT
|
||||||
|
#{item.namespaceId},
|
||||||
|
#{item.groupName},
|
||||||
|
#{item.sceneName},
|
||||||
|
#{item.triggerAt},
|
||||||
|
#{item.runningNum},
|
||||||
|
#{item.finishNum},
|
||||||
|
#{item.maxCountNum},
|
||||||
|
#{item.suspendNum}
|
||||||
|
FROM DUAL
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectRetryTaskList"
|
<select id="selectRetryTaskList"
|
||||||
|
@ -5,14 +5,25 @@
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
||||||
INSERT INTO sj_retry_task_log (unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name,
|
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)
|
args_str, ext_attrs, task_type, create_dt, namespace_id)
|
||||||
VALUES
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
<foreach collection="list" item="item" separator=",">
|
VALUES
|
||||||
(
|
<foreach collection="list" item="item" separator=",">
|
||||||
#{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId},
|
(
|
||||||
#{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs},
|
#{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId},
|
||||||
#{item.taskType}, #{item.createDt}, #{item.namespaceId}
|
#{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs},
|
||||||
)
|
#{item.taskType}, #{item.createDt}, #{item.namespaceId}
|
||||||
</foreach>
|
)
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="list" item="item" separator="UNION ALL">
|
||||||
|
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
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 重试统计 -->
|
<!-- 重试统计 -->
|
||||||
|
@ -5,9 +5,23 @@
|
|||||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
|
||||||
INSERT INTO sj_retry_task_log_message (namespace_id, group_name, unique_id, log_num, message,
|
INSERT INTO sj_retry_task_log_message (namespace_id, group_name, unique_id, log_num, message,
|
||||||
create_dt, real_time)
|
create_dt, real_time)
|
||||||
VALUES
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
<foreach collection="list" item="item" separator=",">
|
VALUES
|
||||||
(
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.namespaceId},
|
||||||
|
#{item.groupName},
|
||||||
|
#{item.uniqueId},
|
||||||
|
#{item.logNum},
|
||||||
|
#{item.message},
|
||||||
|
#{item.createDt},
|
||||||
|
#{item.realTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="list" item="item" separator="UNION ALL">
|
||||||
|
SELECT
|
||||||
#{item.namespaceId},
|
#{item.namespaceId},
|
||||||
#{item.groupName},
|
#{item.groupName},
|
||||||
#{item.uniqueId},
|
#{item.uniqueId},
|
||||||
@ -15,8 +29,9 @@
|
|||||||
#{item.message},
|
#{item.message},
|
||||||
#{item.createDt},
|
#{item.createDt},
|
||||||
#{item.realTime}
|
#{item.realTime}
|
||||||
)
|
FROM DUAL
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
INSERT INTO sj_retry_task (namespace_id, unique_id, group_name, scene_name, idempotent_id, biz_no,
|
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,
|
executor_name, args_str, ext_attrs, next_trigger_at, task_type, retry_status,
|
||||||
create_dt)
|
create_dt)
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
@ -24,6 +25,26 @@
|
|||||||
#{item.createDt}
|
#{item.createDt}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="list" item="item" separator="UNION ALL">
|
||||||
|
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
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -6,19 +6,36 @@
|
|||||||
INSERT INTO sj_server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
INSERT INTO sj_server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||||
expire_at, node_type, ext_attrs, create_dt)
|
expire_at, node_type, ext_attrs, create_dt)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" index="index" separator=",">
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
|
||||||
(
|
<foreach collection="list" item="item" index="index" separator=",">
|
||||||
#{item.namespaceId,jdbcType=VARCHAR},
|
(
|
||||||
#{item.groupName,jdbcType=VARCHAR},
|
#{item.namespaceId,jdbcType=VARCHAR},
|
||||||
#{item.hostId,jdbcType=VARCHAR},
|
#{item.groupName,jdbcType=VARCHAR},
|
||||||
#{item.hostIp,jdbcType=VARCHAR},
|
#{item.hostId,jdbcType=VARCHAR},
|
||||||
#{item.hostPort,jdbcType=INTEGER},
|
#{item.hostIp,jdbcType=VARCHAR},
|
||||||
#{item.expireAt,jdbcType=TIMESTAMP},
|
#{item.hostPort,jdbcType=INTEGER},
|
||||||
#{item.nodeType,jdbcType=TINYINT},
|
#{item.expireAt,jdbcType=TIMESTAMP},
|
||||||
#{item.extAttrs,jdbcType=VARCHAR},
|
#{item.nodeType,jdbcType=TINYINT},
|
||||||
#{item.createDt,jdbcType=TIMESTAMP}
|
#{item.extAttrs,jdbcType=VARCHAR},
|
||||||
)
|
#{item.createDt,jdbcType=TIMESTAMP}
|
||||||
</foreach>
|
)
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
|
||||||
|
<foreach collection="records" item="item" index="index" separator="UNION ALL">
|
||||||
|
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
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectActivePodCount"
|
<select id="selectActivePodCount"
|
||||||
|
Loading…
Reference in New Issue
Block a user