gtsoft-snail-job-server/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetryTaskLogMapper.xml

50 lines
3.0 KiB
XML
Raw Normal View History

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.RetryTaskLogMapper">
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.RetryTaskLog">
2023-01-14 20:46:02 +08:00
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="unique_id" jdbcType="VARCHAR" property="uniqueId"/>
<result column="namespace_id" jdbcType="VARCHAR" property="namespaceId"/>
2023-01-14 20:46:02 +08:00
<result column="group_name" jdbcType="VARCHAR" property="groupName"/>
<result column="scene_name" jdbcType="VARCHAR" property="sceneName"/>
<result column="idempotent_id" jdbcType="VARCHAR" property="idempotentId"/>
2023-01-14 20:46:02 +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="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 20:46:02 +08:00
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
</resultMap>
<sql id="Base_Column_List">
id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, retry_status,
create_dt, task_type, namespace_id
2023-01-14 20:46:02 +08:00
</sql>
<!-- 定义批量新增的 SQL 映射 -->
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO 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
<foreach collection="list" item="item" separator=",">
(#{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId},
#{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs},
#{item.taskType}, #{item.createDt}, #{item.namespaceId})
</foreach>
</insert>
<!-- 重试统计 -->
<select id="retrySummaryRetryTaskLogList"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryResponseDO">
SELECT namespace_id AS namespaceId,
group_name AS groupName,
scene_name AS sceneName,
SUM(CASE WHEN (retry_status = 0) THEN 1 ELSE 0 END) AS runningNum,
SUM(CASE WHEN (retry_status = 1) THEN 1 ELSE 0 END) AS finishNum,
SUM(CASE WHEN (retry_status = 2) THEN 1 ELSE 0 END) AS maxCountNum,
SUM(CASE WHEN (retry_status = 3) THEN 1 ELSE 0 END) AS suspendNum
FROM retry_task_log
${ew.customSqlSegment}
</select>
2023-01-14 21:02:18 +08:00
</mapper>