wip(sj_1.1.0-beta1): updateBatch系列脚本增加update_dt=CURRENT_TIMESTAMP

This commit is contained in:
dhb52 2024-06-22 15:53:14 +08:00
parent a8f0117835
commit 6bdbd2c41e
28 changed files with 57 additions and 28 deletions

View File

@ -5,7 +5,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
UPDATE sj_job UPDATE sj_job
SET next_trigger_at = #{item.nextTriggerAt} SET next_trigger_at = #{item.nextTriggerAt},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -11,7 +11,8 @@
stop_num = #{item.stopNum}, stop_num = #{item.stopNum},
stop_reason = #{item.stopReason}, stop_reason = #{item.stopReason},
cancel_num = #{item.cancelNum}, cancel_num = #{item.cancelNum},
cancel_reason = #{item.cancelReason} cancel_reason = #{item.cancelReason},
update_dt = CURRENT_TIMESTAMP
WHERE system_task_type = #{item.systemTaskType} WHERE system_task_type = #{item.systemTaskType}
AND business_id = #{item.businessId} AND business_id = #{item.businessId}
AND trigger_at = #{item.triggerAt} AND trigger_at = #{item.triggerAt}

View File

@ -8,7 +8,8 @@
SET running_num = #{item.runningNum}, SET running_num = #{item.runningNum},
finish_num = #{item.finishNum}, finish_num = #{item.finishNum},
max_count_num = #{item.maxCountNum}, max_count_num = #{item.maxCountNum},
suspend_num = #{item.suspendNum} suspend_num = #{item.suspendNum},
update_dt = CURRENT_TIMESTAMP
WHERE trigger_at = #{item.triggerAt} WHERE trigger_at = #{item.triggerAt}
AND group_name = #{item.groupName} AND group_name = #{item.groupName}
AND namespace_id = #{item.namespaceId} AND namespace_id = #{item.namespaceId}

View File

@ -5,7 +5,8 @@
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;">
UPDATE sj_retry_task_log_message UPDATE sj_retry_task_log_message
SET message = #{item.message}, log_num = #{item.logNum} SET message = #{item.message}, log_num = #{item.logNum},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -5,7 +5,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;">
UPDATE sj_retry_task_${partition} UPDATE sj_retry_task_${partition}
SET next_trigger_at = #{item.nextTriggerAt} SET next_trigger_at = #{item.nextTriggerAt},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -5,7 +5,8 @@
<update id="updateBatchExpireAt" parameterType="java.util.List"> <update id="updateBatchExpireAt" parameterType="java.util.List">
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
UPDATE sj_server_node UPDATE sj_server_node
SET expire_at = #{item.expireAt} SET expire_at = #{item.expireAt},
update_dt = CURRENT_TIMESTAMP
WHERE host_id = #{item.hostId} WHERE host_id = #{item.hostId}
AND host_ip = #{item.hostIp} AND host_ip = #{item.hostIp}
</foreach> </foreach>

View File

@ -5,7 +5,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
UPDATE sj_workflow UPDATE sj_workflow
SET next_trigger_at = #{item.nextTriggerAt} SET next_trigger_at = #{item.nextTriggerAt},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -5,7 +5,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
UPDATE sj_job UPDATE sj_job
SET next_trigger_at = #{item.nextTriggerAt} SET next_trigger_at = #{item.nextTriggerAt},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -11,7 +11,8 @@
stop_num = #{item.stopNum}, stop_num = #{item.stopNum},
stop_reason = #{item.stopReason}, stop_reason = #{item.stopReason},
cancel_num = #{item.cancelNum}, cancel_num = #{item.cancelNum},
cancel_reason = #{item.cancelReason} cancel_reason = #{item.cancelReason},
update_dt = CURRENT_TIMESTAMP
WHERE system_task_type = #{item.systemTaskType} WHERE system_task_type = #{item.systemTaskType}
AND business_id = #{item.businessId} AND business_id = #{item.businessId}
AND trigger_at = #{item.triggerAt} AND trigger_at = #{item.triggerAt}

View File

@ -8,7 +8,8 @@
SET running_num = #{item.runningNum}, SET running_num = #{item.runningNum},
finish_num = #{item.finishNum}, finish_num = #{item.finishNum},
max_count_num = #{item.maxCountNum}, max_count_num = #{item.maxCountNum},
suspend_num = #{item.suspendNum} suspend_num = #{item.suspendNum},
update_dt = CURRENT_TIMESTAMP
WHERE trigger_at = #{item.triggerAt} WHERE trigger_at = #{item.triggerAt}
AND group_name = #{item.groupName} AND group_name = #{item.groupName}
AND namespace_id = #{item.namespaceId} AND namespace_id = #{item.namespaceId}

View File

@ -5,7 +5,8 @@
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;">
UPDATE sj_retry_task_log_message UPDATE sj_retry_task_log_message
SET message = #{item.message}, log_num = #{item.logNum} SET message = #{item.message}, log_num = #{item.logNum},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -5,7 +5,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;">
UPDATE sj_retry_task_${partition} UPDATE sj_retry_task_${partition}
SET next_trigger_at = #{item.nextTriggerAt} SET next_trigger_at = #{item.nextTriggerAt},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -5,7 +5,8 @@
<update id="updateBatchExpireAt" parameterType="java.util.List"> <update id="updateBatchExpireAt" parameterType="java.util.List">
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
UPDATE sj_server_node UPDATE sj_server_node
SET expire_at = #{item.expireAt} SET expire_at = #{item.expireAt},
update_dt = CURRENT_TIMESTAMP
WHERE host_id = #{item.hostId} WHERE host_id = #{item.hostId}
AND host_ip = #{item.hostIp} AND host_ip = #{item.hostIp}
</foreach> </foreach>

View File

@ -5,7 +5,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;"> <foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
UPDATE sj_workflow UPDATE sj_workflow
SET next_trigger_at = #{item.nextTriggerAt} SET next_trigger_at = #{item.nextTriggerAt},
update_dt = CURRENT_TIMESTAMP
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@ -4,7 +4,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
UPDATE sj_job AS rt UPDATE sj_job AS rt
SET next_trigger_at = tt.next_trigger_at SET next_trigger_at = tt.next_trigger_at,
update_dt = CURRENT_TIMESTAMP
FROM ( FROM (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">
SELECT SELECT

View File

@ -10,7 +10,8 @@
stop_num = tt.stop_num, stop_num = tt.stop_num,
stop_reason = tt.stop_reason, stop_reason = tt.stop_reason,
cancel_num = tt.cancel_num, cancel_num = tt.cancel_num,
cancel_reason = tt.cancel_reason cancel_reason = tt.cancel_reason,
update_dt = CURRENT_TIMESTAMP
FROM ( FROM (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">
SELECT SELECT

View File

@ -7,7 +7,8 @@
SET running_num = tt.running_num, SET running_num = tt.running_num,
finish_num = tt.finish_num, finish_num = tt.finish_num,
max_count_num = tt.max_count_num, max_count_num = tt.max_count_num,
suspend_num = tt.suspend_num suspend_num = tt.suspend_num,
update_dt = CURRENT_TIMESTAMP
FROM ( FROM (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">
SELECT SELECT

View File

@ -13,7 +13,8 @@
</foreach> </foreach>
) tt ) tt
SET rt.message = tt.message, SET rt.message = tt.message,
rt.log_num = tt.log_num rt.log_num = tt.log_num,
rt.update_dt = CURRENT_TIMESTAMP
WHERE rt.id = tt.id WHERE rt.id = tt.id
</update> </update>

View File

@ -4,7 +4,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
UPDATE sj_retry_task_${partition} AS rt UPDATE sj_retry_task_${partition} AS rt
SET next_trigger_at = tt.next_trigger_at SET next_trigger_at = tt.next_trigger_at,
update_dt = CURRENT_TIMESTAMP
FROM ( FROM (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">
SELECT SELECT

View File

@ -4,7 +4,8 @@
<update id="updateBatchExpireAt" parameterType="java.util.List"> <update id="updateBatchExpireAt" parameterType="java.util.List">
UPDATE sj_server_node AS rt UPDATE sj_server_node AS rt
SET expire_at = tt.expire_at SET expire_at = tt.expire_at,
update_dt = CURRENT_TIMESTAMP
FROM ( FROM (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">
SELECT SELECT

View File

@ -4,7 +4,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
UPDATE sj_workflow AS rt UPDATE sj_workflow AS rt
SET next_trigger_at = tt.next_trigger_at SET next_trigger_at = tt.next_trigger_at,
update_dt = CURRENT_TIMESTAMP
FROM ( FROM (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">
SELECT SELECT

View File

@ -4,7 +4,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
UPDATE sj_job UPDATE sj_job
SET next_trigger_at = src.next_trigger_at SET next_trigger_at = src.next_trigger_at,
update_dt = CURRENT_TIMESTAMP
FROM sj_job AS dest FROM sj_job AS dest
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">

View File

@ -10,7 +10,8 @@
stop_num = src.stop_num, stop_num = src.stop_num,
stop_reason = src.stop_reason, stop_reason = src.stop_reason,
cancel_num = src.cancel_num, cancel_num = src.cancel_num,
cancel_reason = src.cancel_reason cancel_reason = src.cancel_reason,
update_dt = CURRENT_TIMESTAMP
FROM sj_job_summary AS dest FROM sj_job_summary AS dest
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">

View File

@ -7,7 +7,8 @@
SET running_num = src.running_num, SET running_num = src.running_num,
finish_num = src.finish_num, finish_num = src.finish_num,
max_count_num = src.max_count_num, max_count_num = src.max_count_num,
suspend_num = src.suspend_num suspend_num = src.suspend_num,
update_dt = CURRENT_TIMESTAMP
FROM sj_retry_summary AS dest FROM sj_retry_summary AS dest
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">

View File

@ -4,7 +4,9 @@
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
UPDATE sj_retry_task_log_message UPDATE sj_retry_task_log_message
SET message = src.message, log_num = src.log_num SET message = src.message,
log_num = src.log_num,
update_dt = CURRENT_TIMESTAMP
FROM sj_retry_task_log_message AS dest FROM sj_retry_task_log_message AS dest
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">

View File

@ -4,7 +4,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
UPDATE sj_retry_task_${partition} UPDATE sj_retry_task_${partition}
SET next_trigger_at = src.next_trigger_at SET next_trigger_at = src.next_trigger_at,
update_dt = CURRENT_TIMESTAMP
FROM sj_retry_task_${partition} AS target FROM sj_retry_task_${partition} AS target
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">

View File

@ -4,7 +4,8 @@
<update id="updateBatchExpireAt" parameterType="java.util.List"> <update id="updateBatchExpireAt" parameterType="java.util.List">
UPDATE sj_server_node UPDATE sj_server_node
SET expire_at = src.expire_at SET expire_at = src.expire_at,
update_dt = CURRENT_TIMESTAMP
FROM sj_server_node AS dest FROM sj_server_node AS dest
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">

View File

@ -4,7 +4,8 @@
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
UPDATE sj_workflow UPDATE sj_workflow
SET next_trigger_at = src.next_trigger_at SET next_trigger_at = src.next_trigger_at,
update_dt = CURRENT_TIMESTAMP
FROM sj_workflow dest FROM sj_workflow dest
JOIN ( JOIN (
<foreach collection="list" item="item" index="index" separator="UNION ALL"> <foreach collection="list" item="item" index="index" separator="UNION ALL">