feat(3.2.0): inserOrUpdate的改造, 数据库适配
This commit is contained in:
parent
31b317a3b1
commit
2eb6324990
@ -19,10 +19,9 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
job_summary (namespace_id, group_name, business_id, trigger_at,
|
||||
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO 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
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
@ -40,26 +39,46 @@
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
success_num = values(`success_num`),
|
||||
fail_num = values(`fail_num`),
|
||||
fail_reason = values(`fail_reason`),
|
||||
stop_num = values(`stop_num`),
|
||||
stop_reason = values(`stop_reason`),
|
||||
cancel_num = values(`cancel_num`),
|
||||
cancel_reason = values(`cancel_reason`)
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE job_summary rt,
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.businessId} AS business_id
|
||||
</foreach>
|
||||
) tt
|
||||
SET
|
||||
rt.success_num = tt.success_num,
|
||||
rt.fail_num = tt.fail_num,
|
||||
rt.fail_reason = tt.fail_reason,
|
||||
rt.stop_num = tt.stop_num,
|
||||
rt.stop_reason = tt.stop_reason,
|
||||
rt.cancel_num = tt.cancel_num,
|
||||
rt.cancel_reason = tt.cancel_reason
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
AND rt.business_id = tt.business_id
|
||||
</update>
|
||||
|
||||
<select id="jobLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
DATE_FORMAT(trigger_at, #{dateFormat}) AS createDt,
|
||||
ifnull(SUM(success_num), 0) AS success,
|
||||
ifnull(SUM(fail_num), 0) AS failNum,
|
||||
ifnull(SUM(stop_num), 0) AS stop,
|
||||
ifnull(SUM(cancel_num), 0) AS cancel,
|
||||
ifnull(SUM(fail_num + stop_num + cancel_num), 0) AS fail,
|
||||
ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total
|
||||
DATE_FORMAT(trigger_at, #{dateFormat}) AS createDt,
|
||||
IFNULL(SUM(success_num), 0) AS success,
|
||||
IFNULL(SUM(fail_num), 0) AS failNum,
|
||||
IFNULL(SUM(stop_num), 0) AS stop,
|
||||
IFNULL(SUM(cancel_num), 0) AS cancel,
|
||||
IFNULL(SUM(fail_num + stop_num + cancel_num), 0) AS fail,
|
||||
IFNULL(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total
|
||||
FROM job_summary
|
||||
${ew.customSqlSegment}
|
||||
GROUP BY DATE_FORMAT(trigger_at, #{dateFormat})
|
||||
@ -67,11 +86,11 @@
|
||||
|
||||
<select id="toJobTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$JobTask">
|
||||
SELECT ifnull(sum(success_num), 0) AS successNum,
|
||||
ifnull(sum(stop_num), 0) AS stopNum,
|
||||
ifnull(sum(cancel_num), 0) AS cancelNum,
|
||||
ifnull(sum(fail_num), 0) AS failNum,
|
||||
ifnull(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum
|
||||
SELECT IFNULL(sum(success_num), 0) AS successNum,
|
||||
IFNULL(sum(stop_num), 0) AS stopNum,
|
||||
IFNULL(sum(cancel_num), 0) AS cancelNum,
|
||||
IFNULL(sum(fail_num), 0) AS failNum,
|
||||
IFNULL(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum
|
||||
FROM job_summary
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
@ -15,30 +15,49 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
||||
suspend_num)
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO retry_summary (namespace_id, group_name, scene_name, trigger_at,
|
||||
running_num, finish_num, max_count_num, suspend_num)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
running_num = values(`running_num`),
|
||||
finish_num = values(`finish_num`),
|
||||
max_count_num = values(`max_count_num`),
|
||||
suspend_num = values(`suspend_num`)
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE retry_summary rt,
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.runningNum} AS running_num,
|
||||
#{item.finishNum} AS finish_num,
|
||||
#{item.maxCountNum} AS max_count_num,
|
||||
#{item.suspendNum} AS suspend_num,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.sceneName} AS scene_name,
|
||||
#{item.namespaceId} AS namespace_id,
|
||||
#{item.groupName} AS group_name
|
||||
</foreach>
|
||||
) tt
|
||||
SET rt.running_num = tt.running_num,
|
||||
rt.finish_num = tt.finish_num,
|
||||
rt.max_count_num = tt.max_count_num,
|
||||
rt.suspend_num = tt.suspend_num
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
AND rt.group_name = tt.group_name
|
||||
AND rt.namespace_id = tt.namespace_id
|
||||
AND rt.scene_name = tt.scene_name
|
||||
</update>
|
||||
|
||||
<select id="retryTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
||||
SELECT ifnull(sum(running_num), 0) AS runningNum,
|
||||
|
@ -17,18 +17,43 @@
|
||||
<sql id="Base_Column_List">
|
||||
id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
<insert id="insertOrUpdate" parameterType="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
values
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(#{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.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
expire_at = values(`expire_at`)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(
|
||||
#{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.contextPath,jdbcType=VARCHAR},
|
||||
#{item.createDt,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdateExpireAt" parameterType="java.util.List">
|
||||
UPDATE server_node rt,
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.expireAt} AS expire_at,
|
||||
#{item.contextPath} AS context_path,
|
||||
#{item.hostId} AS host_id,
|
||||
#{item.hostIp} AS host_ip
|
||||
</foreach>
|
||||
) tt
|
||||
SET rt.expire_at = tt.expire_at,
|
||||
rt.context_path = tt.context_path
|
||||
WHERE rt.host_id = tt.host_id and rt.host_ip = tt.host_ip
|
||||
</update>
|
||||
|
||||
<select id="countActivePod" resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT node_type as nodeType, count(*) as total
|
||||
from server_node
|
||||
|
@ -40,31 +40,32 @@
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE job_summary rt,
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.businessId} AS business_id
|
||||
</foreach>
|
||||
) tt
|
||||
SET
|
||||
rt.success_num = tt.success_num,
|
||||
rt.fail_num = tt.fail_num,
|
||||
rt.fail_reason = tt.fail_reason,
|
||||
rt.stop_num = tt.stop_num,
|
||||
rt.stop_reason = tt.stop_reason,
|
||||
rt.cancel_num = tt.cancel_num,
|
||||
rt.cancel_reason = tt.cancel_reason
|
||||
WHERE rt.trigger_at = tt.trigger_at and rt.business_id = tt.business_id
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.businessId} AS business_id
|
||||
</foreach>
|
||||
) tt
|
||||
SET rt.success_num = tt.success_num,
|
||||
rt.fail_num = tt.fail_num,
|
||||
rt.fail_reason = tt.fail_reason,
|
||||
rt.stop_num = tt.stop_num,
|
||||
rt.stop_reason = tt.stop_reason,
|
||||
rt.cancel_num = tt.cancel_num,
|
||||
rt.cancel_reason = tt.cancel_reason
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
AND rt.business_id = tt.business_id
|
||||
</update>
|
||||
|
||||
<select id="jobLineList"
|
||||
|
@ -20,43 +20,43 @@
|
||||
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
||||
suspend_num)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE retry_summary rt,
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.runningNum} AS running_num,
|
||||
#{item.finishNum} AS finish_num,
|
||||
#{item.maxCountNum} AS max_count_num,
|
||||
#{item.suspendNum} AS suspend_num,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.sceneName} AS scene_name,
|
||||
#{item.namespaceId} AS namespace_id,
|
||||
#{item.groupName} AS group_name
|
||||
</foreach>
|
||||
) tt
|
||||
SET
|
||||
rt.running_num = tt.running_num,
|
||||
rt.finish_num = tt.finish_num,
|
||||
rt.max_count_num = tt.max_count_num,
|
||||
rt.suspend_num = tt.suspend_num
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
and rt.group_name = tt.group_name
|
||||
and rt.namespace_id = tt.namespace_id
|
||||
and rt.scene_name = tt.scene_name
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.runningNum} AS running_num,
|
||||
#{item.finishNum} AS finish_num,
|
||||
#{item.maxCountNum} AS max_count_num,
|
||||
#{item.suspendNum} AS suspend_num,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.sceneName} AS scene_name,
|
||||
#{item.namespaceId} AS namespace_id,
|
||||
#{item.groupName} AS group_name
|
||||
</foreach>
|
||||
) tt
|
||||
SET rt.running_num = tt.running_num,
|
||||
rt.finish_num = tt.finish_num,
|
||||
rt.max_count_num = tt.max_count_num,
|
||||
rt.suspend_num = tt.suspend_num
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
AND rt.group_name = tt.group_name
|
||||
AND rt.namespace_id = tt.namespace_id
|
||||
AND rt.scene_name = tt.scene_name
|
||||
</update>
|
||||
|
||||
<select id="retryTask"
|
||||
|
@ -17,47 +17,52 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, namespace_id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
id, namespace_id, group_name, context_path, host_id, host_ip, host_port,
|
||||
expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(
|
||||
#{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.contextPath,jdbcType=VARCHAR},
|
||||
#{item.createDt,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</foreach>
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(
|
||||
#{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.contextPath,jdbcType=VARCHAR},
|
||||
#{item.createDt,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdateExpireAt" parameterType="java.util.List">
|
||||
UPDATE server_node rt,
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.expireAt} AS expire_at,
|
||||
#{item.contextPath} AS context_path,
|
||||
#{item.hostId} AS host_id,
|
||||
#{item.hostIp} AS host_ip
|
||||
</foreach>
|
||||
) tt
|
||||
SET rt.expire_at = tt.expire_at, rt.context_path = tt.context_path,
|
||||
WHERE rt.host_id = tt.host_id and rt.host_ip = tt.host_ip
|
||||
(
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.expireAt} AS expire_at,
|
||||
#{item.contextPath} AS context_path,
|
||||
#{item.hostId} AS host_id,
|
||||
#{item.hostIp} AS host_ip
|
||||
</foreach>
|
||||
) tt
|
||||
SET rt.expire_at = tt.expire_at,
|
||||
rt.context_path = tt.context_path
|
||||
WHERE rt.host_id = tt.host_id
|
||||
AND rt.host_ip = tt.host_ip
|
||||
</update>
|
||||
|
||||
<select id="countActivePod"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT node_type AS nodeType,
|
||||
COUNT(*) AS total
|
||||
FROM server_node ${ew.customSqlSegment}
|
||||
FROM server_node
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -19,58 +19,42 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="false" keyProperty="id">
|
||||
MERGE INTO job_summary dest
|
||||
USING (
|
||||
<foreach collection="list" item="item" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.namespaceId} AS namespace_id,
|
||||
#{item.groupName} AS group_name,
|
||||
#{item.businessId} AS business_id,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.systemTaskType} AS system_task_type,
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
) src
|
||||
ON (dest.business_id = src.business_id AND dest.trigger_at = src.trigger_at AND dest.system_task_type = src.system_task_type)
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
dest.success_num = src.success_num,
|
||||
dest.fail_num = src.fail_num,
|
||||
dest.fail_reason = src.fail_reason,
|
||||
dest.stop_num = src.stop_num,
|
||||
dest.stop_reason = src.stop_reason,
|
||||
dest.cancel_num = src.cancel_num,
|
||||
dest.cancel_reason = src.cancel_reason
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (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
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.businessId},
|
||||
#{item.triggerAt},
|
||||
#{item.systemTaskType},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false" keyProperty="id">
|
||||
INSERT INTO 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)
|
||||
<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>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;">
|
||||
UPDATE job_summary
|
||||
SET success_num = #{item.successNum},
|
||||
fail_num = #{item.failNum},
|
||||
fail_reason = #{item.failReason},
|
||||
stop_num = #{item.stopNum},
|
||||
stop_reason = #{item.stopReason},
|
||||
cancel_num = #{item.cancelNum},
|
||||
cancel_reason = #{item.cancelReason}
|
||||
WHERE trigger_at = #{item.triggerAt}
|
||||
AND business_id = #{item.businessId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="jobLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
|
@ -15,50 +15,37 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="false" keyProperty="id">
|
||||
MERGE INTO retry_summary dest
|
||||
USING (
|
||||
<foreach collection="list" item="item" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.namespaceId} AS namespace_id,
|
||||
#{item.groupName} AS group_name,
|
||||
#{item.sceneName} AS scene_name,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.runningNum} AS running_num,
|
||||
#{item.finishNum} AS finish_num,
|
||||
#{item.maxCountNum} AS max_count_num,
|
||||
#{item.suspendNum AS suspend_num}
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
) src
|
||||
ON (dest.namespace_id = src.namespace_id
|
||||
AND dest.group_name = src.group_name
|
||||
AND dest.scene_name = src.scene_name
|
||||
AND dest.trigger_at = src.trigger_at)
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
dest.running_num = src.running_num,
|
||||
dest.finish_num = src.finish_num,
|
||||
dest.max_count_num = src.max_count_num,
|
||||
dest.suspend_num = src.suspend_num
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (namespace_id, group_name, scene_name, trigger_at,
|
||||
running_num, finish_num, max_count_num, suspend_num)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false" keyProperty="id">
|
||||
INSERT INTO retry_summary (namespace_id, group_name, scene_name, trigger_at,
|
||||
running_num, finish_num, max_count_num, suspend_num)
|
||||
<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>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" index="index" open="BEGIN" separator=";" close=";END;">
|
||||
UPDATE retry_summary
|
||||
SET running_num = #{item.runningNum},
|
||||
finish_num = #{item.finishNum},
|
||||
max_count_num = #{item.maxCountNum},
|
||||
suspend_num = #{item.suspendNum}
|
||||
WHERE trigger_at = #{item.triggerAt}
|
||||
AND group_name = #{item.groupName}
|
||||
AND namespace_id = #{item.namespaceId}
|
||||
AND scene_name = #{item.sceneName}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="retryTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
||||
SELECT COALESCE(sum(running_num), 0) AS runningNum,
|
||||
@ -75,8 +62,7 @@
|
||||
SELECT *
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
trigger_at, running_num, finish_num, max_count_num, suspend_num
|
||||
SELECT trigger_at, running_num, finish_num, max_count_num, suspend_num
|
||||
FROM retry_summary
|
||||
${ew.customSqlSegment}
|
||||
)
|
||||
|
@ -19,40 +19,36 @@
|
||||
id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode"
|
||||
useGeneratedKeys="false" keyProperty="id">
|
||||
MERGE INTO server_node dest
|
||||
USING(
|
||||
<foreach collection="records" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.namespaceId,jdbcType=VARCHAR} AS namespace_id,
|
||||
#{item.groupName,jdbcType=VARCHAR} AS group_name,
|
||||
#{item.hostId,jdbcType=VARCHAR} AS host_id,
|
||||
#{item.hostIp,jdbcType=VARCHAR} AS host_ip,
|
||||
#{item.hostPort,jdbcType=INTEGER} AS host_port,
|
||||
#{item.expireAt,jdbcType=TIMESTAMP} AS expire_at,
|
||||
#{item.nodeType,jdbcType=TINYINT} AS node_type,
|
||||
#{item.extAttrs,jdbcType=VARCHAR} AS ext_attrs,
|
||||
#{item.contextPath,jdbcType=VARCHAR} AS context_path,
|
||||
#{item.createDt,jdbcType=TIMESTAMP} AS create_dt
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
) src
|
||||
ON( dest.host_id = src.host_id AND dest.host_ip = src.host_ip)
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET expire_at = src.expire_at
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(#{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.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false" keyProperty="id">
|
||||
<!-- useGeneratedKeys="false" 否则报错ORA-00933: SQL command not properly ended -->
|
||||
INSERT INTO server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
<foreach collection="records" item="item" index="index" separator=" UNION ">
|
||||
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.contextPath,jdbcType=VARCHAR},
|
||||
#{item.createDt,jdbcType=TIMESTAMP}
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdateExpireAt" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" open="BEGIN" separator=";" close=";END;">
|
||||
UPDATE server_node
|
||||
SET expire_at = #{item.expireAt},
|
||||
context_path = #{item.contextPath}
|
||||
WHERE host_id = #{item.hostId}
|
||||
AND host_ip = #{item.hostIp}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="countActivePod"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT
|
||||
|
@ -19,37 +19,55 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
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)
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO 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
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.businessId},
|
||||
#{item.triggerAt},
|
||||
#{item.systemTaskType},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
ON CONFLICT (business_id, trigger_at, system_task_type) DO UPDATE
|
||||
SET success_num = EXCLUDED.success_num,
|
||||
fail_num = EXCLUDED.fail_num,
|
||||
fail_reason = EXCLUDED.fail_reason,
|
||||
stop_num = EXCLUDED.stop_num,
|
||||
stop_reason = EXCLUDED.stop_reason,
|
||||
cancel_num = EXCLUDED.cancel_num,
|
||||
cancel_reason = EXCLUDED.cancel_reason
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.businessId},
|
||||
#{item.triggerAt},
|
||||
#{item.systemTaskType},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE job_summary AS rt
|
||||
SET success_num = tt.success_num,
|
||||
fail_num = tt.fail_num,
|
||||
fail_reason = tt.fail_reason,
|
||||
stop_num = tt.stop_num,
|
||||
stop_reason = tt.stop_reason,
|
||||
cancel_num = tt.cancel_num,
|
||||
cancel_reason = tt.cancel_reason
|
||||
FROM (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.businessId} AS business_id
|
||||
</foreach>
|
||||
) AS tt
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
AND rt.business_id = tt.business_id
|
||||
</update>
|
||||
|
||||
<select id="jobLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
|
@ -15,30 +15,49 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
||||
suspend_num)
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO retry_summary (namespace_id, group_name, scene_name, trigger_at,
|
||||
running_num, finish_num, max_count_num, suspend_num)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
ON CONFLICT (namespace_id, group_name, scene_name, trigger_at) DO UPDATE
|
||||
SET running_num = EXCLUDED.running_num,
|
||||
finish_num = EXCLUDED.finish_num,
|
||||
max_count_num = EXCLUDED.max_count_num,
|
||||
suspend_num = EXCLUDED.suspend_num
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE retry_summary AS rt
|
||||
SET running_num = tt.running_num,
|
||||
finish_num = tt.finish_num,
|
||||
max_count_num = tt.max_count_num,
|
||||
suspend_num = tt.suspend_num
|
||||
FROM (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.runningNum} AS running_num,
|
||||
#{item.finishNum} AS finish_num,
|
||||
#{item.maxCountNum} AS max_count_num,
|
||||
#{item.suspendNum} AS suspend_num,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.sceneName} AS scene_name,
|
||||
#{item.namespaceId} AS namespace_id,
|
||||
#{item.groupName} AS group_name
|
||||
</foreach>
|
||||
) AS tt
|
||||
WHERE rt.trigger_at = tt.trigger_at
|
||||
AND rt.group_name = tt.group_name
|
||||
AND rt.namespace_id = tt.namespace_id
|
||||
AND rt.scene_name = tt.scene_name
|
||||
</update>
|
||||
|
||||
<select id="retryTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
||||
SELECT COALESCE(sum(running_num), 0) AS runningNum,
|
||||
|
@ -17,19 +17,44 @@
|
||||
<sql id="Base_Column_List">
|
||||
id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
<insert id="insertOrUpdate" parameterType="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(#{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.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
ON CONFLICT (host_id, host_ip) DO UPDATE SET expire_at = EXCLUDED.expire_at
|
||||
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(
|
||||
#{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.contextPath,jdbcType=VARCHAR},
|
||||
#{item.createDt,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdateExpireAt" parameterType="java.util.List">
|
||||
UPDATE server_node AS rt
|
||||
SET expire_at = tt.expire_at,
|
||||
context_path = tt.context_path
|
||||
FROM (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.expireAt} AS expire_at,
|
||||
#{item.contextPath} AS context_path,
|
||||
#{item.hostId} AS host_id,
|
||||
#{item.hostIp} AS host_ip
|
||||
</foreach>
|
||||
) AS tt
|
||||
WHERE rt.host_id = tt.host_id
|
||||
AND rt.host_ip = tt.host_ip
|
||||
</update>
|
||||
|
||||
<select id="countActivePod"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT node_type as nodeType, count(*) as total
|
||||
|
@ -28,14 +28,15 @@
|
||||
|
||||
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
|
||||
UPDATE job
|
||||
SET job.next_trigger_at = src.next_trigger_at
|
||||
FROM job
|
||||
JOIN (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.nextTriggerAt} AS next_trigger_at,
|
||||
#{item.id} AS id
|
||||
</foreach>
|
||||
) AS src ON job.id = src.id;
|
||||
SET next_trigger_at = src.next_trigger_at
|
||||
FROM job AS dest
|
||||
JOIN (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.nextTriggerAt} AS next_trigger_at,
|
||||
#{item.id} AS id
|
||||
</foreach>
|
||||
) AS src
|
||||
ON (dest.id = src.id)
|
||||
</update>
|
||||
</mapper>
|
||||
|
@ -19,47 +19,55 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
MERGE INTO job_summary AS target
|
||||
USING (
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.businessId},
|
||||
#{item.triggerAt},
|
||||
#{item.systemTaskType},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
) AS source (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)
|
||||
ON target.namespace_id = source.namespace_id
|
||||
AND target.business_id = source.business_id
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
target.success_num = source.success_num,
|
||||
target.fail_num = source.fail_num,
|
||||
target.fail_reason = source.fail_reason,
|
||||
target.stop_num = source.stop_num,
|
||||
target.stop_reason = source.stop_reason,
|
||||
target.cancel_num = source.cancel_num,
|
||||
target.cancel_reason = source.cancel_reason
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (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 (source.namespace_id, source.group_name, source.business_id, source.trigger_at, source.system_task_type,
|
||||
source.success_num, source.fail_num, source.fail_reason, source.stop_num, source.stop_reason,
|
||||
source.cancel_num, source.cancel_reason);
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO 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
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.businessId},
|
||||
#{item.triggerAt},
|
||||
#{item.systemTaskType},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE job_summary
|
||||
SET success_num = src.success_num,
|
||||
fail_num = src.fail_num,
|
||||
fail_reason = src.fail_reason,
|
||||
stop_num = src.stop_num,
|
||||
stop_reason = src.stop_reason,
|
||||
cancel_num = src.cancel_num,
|
||||
cancel_reason = src.cancel_reason
|
||||
FROM job_summary AS dest
|
||||
JOIN (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.businessId} AS business_id
|
||||
</foreach>
|
||||
) AS src
|
||||
ON (dest.trigger_at = src.trigger_at AND dest.business_id = src.business_id)
|
||||
</update>
|
||||
|
||||
<select id="jobLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
|
@ -15,41 +15,55 @@
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
MERGE INTO retry_summary AS target
|
||||
USING (
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
) AS source (namespace_id, group_name, scene_name, trigger_at,
|
||||
running_num, finish_num, max_count_num, suspend_num)
|
||||
ON target.namespace_id = source.namespace_id
|
||||
AND target.group_name = source.group_name
|
||||
AND target.scene_name = source.scene_name
|
||||
AND target.trigger_at = source.trigger_at
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
target.running_num = source.running_num,
|
||||
target.finish_num = source.finish_num,
|
||||
target.max_count_num = source.max_count_num,
|
||||
target.suspend_num = source.suspend_num
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (namespace_id, group_name, scene_name, trigger_at,
|
||||
running_num, finish_num, max_count_num, suspend_num)
|
||||
VALUES (source.namespace_id, source.group_name, source.scene_name, source.trigger_at,
|
||||
source.running_num, source.finish_num, source.max_count_num, source.suspend_num);
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO 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
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.businessId},
|
||||
#{item.triggerAt},
|
||||
#{item.systemTaskType},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
UPDATE job_summary
|
||||
SET success_num = src.success_num,
|
||||
fail_num = src.fail_num,
|
||||
fail_reason = src.fail_reason,
|
||||
stop_num = src.stop_num,
|
||||
stop_reason = src.stop_reason,
|
||||
cancel_num = src.cancel_num,
|
||||
cancel_reason = src.cancel_reason
|
||||
FROM job_summary AS dest
|
||||
JOIN (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.successNum} AS success_num,
|
||||
#{item.failNum} AS fail_num,
|
||||
#{item.failReason} AS fail_reason,
|
||||
#{item.stopNum} AS stop_num,
|
||||
#{item.stopReason} AS stop_reason,
|
||||
#{item.cancelNum} AS cancel_num,
|
||||
#{item.cancelReason} AS cancel_reason,
|
||||
#{item.triggerAt} AS trigger_at,
|
||||
#{item.businessId} AS business_id
|
||||
</foreach>
|
||||
) AS src
|
||||
ON (dest.trigger_at = src.trigger_at AND dest.business_id = src.business_id)
|
||||
</update>
|
||||
|
||||
<select id="retryTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
||||
SELECT
|
||||
|
@ -20,33 +20,43 @@
|
||||
id, namespace_id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
MERGE INTO server_node AS target
|
||||
USING (
|
||||
VALUES
|
||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(
|
||||
#{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.contextPath,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.contextPath,jdbcType=VARCHAR},
|
||||
#{item.createDt,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</foreach>
|
||||
) AS source (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
ON target.namespace_id = source.namespace_id
|
||||
AND target.group_name = source.group_name
|
||||
AND target.host_id = source.host_id
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
target.expire_at = source.expire_at, target.update_dt = GETDATE()
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (namespace_id, group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt, update_dt)
|
||||
VALUES (source.namespace_id, source.group_name, source.host_id, source.host_ip, source.host_port,
|
||||
source.expire_at, source.node_type, source.ext_attrs, source.context_path, source.create_dt, GETDATE());
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdateExpireAt" parameterType="java.util.List">
|
||||
UPDATE server_node
|
||||
SET expire_at = src.expire_at,
|
||||
context_path = src.context_path
|
||||
FROM server_node AS dest
|
||||
JOIN (
|
||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||
SELECT
|
||||
#{item.expireAt} AS expire_at,
|
||||
#{item.contextPath} AS context_path,
|
||||
#{item.hostId} AS host_id,
|
||||
#{item.hostIp} AS host_ip
|
||||
</foreach>
|
||||
) AS src
|
||||
ON (dest.host_id = src.host_id AND dest.host_ip = src.host_ip)
|
||||
</update>
|
||||
|
||||
<select id="countActivePod"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT
|
||||
|
Loading…
Reference in New Issue
Block a user