2023-01-14 21:02:18 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2023-08-04 22:22:47 +08:00
|
|
|
<mapper namespace="com.aizuda.easy.retry.template.datasource.persistence.mapper.RetryTaskMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.RetryTask">
|
2023-01-14 21:02:18 +08:00
|
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
2023-11-25 23:49:13 +08:00
|
|
|
<result column="namespace_id" jdbcType="VARCHAR" property="namespaceId"/>
|
2023-05-05 16:23:21 +08:00
|
|
|
<result column="unique_id" jdbcType="VARCHAR" property="uniqueId"/>
|
2023-01-14 21:02:18 +08:00
|
|
|
<result column="group_name" jdbcType="VARCHAR" property="groupName" />
|
|
|
|
<result column="scene_name" jdbcType="VARCHAR" property="sceneName" />
|
2023-05-04 18:46:34 +08:00
|
|
|
<result column="idempotent_id" jdbcType="VARCHAR" property="idempotentId" />
|
2023-01-14 21:02:18 +08:00
|
|
|
<result column="biz_no" jdbcType="VARCHAR" property="bizNo" />
|
|
|
|
<result column="executor_name" jdbcType="VARCHAR" property="executorName" />
|
|
|
|
<result column="args_str" jdbcType="VARCHAR" property="argsStr" />
|
|
|
|
<result column="ext_attrs" jdbcType="VARCHAR" property="extAttrs" />
|
|
|
|
<result column="next_trigger_at" jdbcType="TIMESTAMP" property="nextTriggerAt" />
|
|
|
|
<result column="retry_count" jdbcType="TINYINT" property="retryCount" />
|
|
|
|
<result column="retry_status" jdbcType="TINYINT" property="retryStatus" />
|
2023-06-04 18:46:09 +08:00
|
|
|
<result column="task_type" jdbcType="TINYINT" property="taskType"/>
|
2023-01-14 21:02:18 +08:00
|
|
|
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
|
|
|
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
|
|
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
2023-11-25 23:49:13 +08:00
|
|
|
id, namespace_id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, next_trigger_at, retry_count, retry_status,
|
2023-06-04 18:46:09 +08:00
|
|
|
create_dt, update_dt, task_type
|
2023-01-14 21:02:18 +08:00
|
|
|
</sql>
|
2023-07-16 22:58:54 +08:00
|
|
|
<!-- 定义批量新增的 SQL 映射 -->
|
|
|
|
<insert id="batchInsert" parameterType="java.util.List">
|
2023-11-25 23:49:13 +08:00
|
|
|
INSERT INTO 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)
|
2023-07-16 22:58:54 +08:00
|
|
|
VALUES
|
|
|
|
<foreach collection="list" item="item" separator=",">
|
2023-11-25 23:49:13 +08:00
|
|
|
(#{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})
|
2023-07-16 22:58:54 +08:00
|
|
|
</foreach>
|
|
|
|
</insert>
|
2023-11-14 15:16:38 +08:00
|
|
|
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
|
2024-04-01 08:46:24 +08:00
|
|
|
UPDATE retry_task_${partition} rt,
|
|
|
|
(
|
|
|
|
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
|
|
|
SELECT
|
|
|
|
#{item.nextTriggerAt} AS next_trigger_at,
|
|
|
|
#{item.id} AS id
|
|
|
|
</foreach>
|
|
|
|
) tt
|
|
|
|
SET rt.next_trigger_at = tt.next_trigger_at
|
|
|
|
WHERE rt.id = tt.id
|
2023-11-14 15:16:38 +08:00
|
|
|
</update>
|
2023-01-14 20:47:58 +08:00
|
|
|
</mapper>
|