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"/>
|
2023-05-05 16:23:21 +08:00
|
|
|
<result column="unique_id" jdbcType="VARCHAR" property="uniqueId"/>
|
2023-01-14 20:46:02 +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 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">
|
2023-06-16 17:38:19 +08:00
|
|
|
id
|
|
|
|
, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, retry_status,
|
2023-06-04 18:46:09 +08:00
|
|
|
create_dt, task_type
|
2023-01-14 20:46:02 +08:00
|
|
|
</sql>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
|
select
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from retry_task_log
|
|
|
|
where id = #{id,jdbcType=BIGINT}
|
|
|
|
</select>
|
|
|
|
<select id="countTaskTotal" resultType="java.lang.Long">
|
|
|
|
select count(*)
|
2023-06-16 17:38:19 +08:00
|
|
|
from retry_task_log
|
2023-01-14 20:46:02 +08:00
|
|
|
</select>
|
|
|
|
<select id="countTaskByRetryStatus" resultType="java.lang.Long">
|
|
|
|
select count(*)
|
2023-06-16 17:38:19 +08:00
|
|
|
from retry_task_log
|
|
|
|
where retry_status = #{retryStatus}
|
2023-01-14 20:46:02 +08:00
|
|
|
</select>
|
|
|
|
<select id="rankSceneQuantity"
|
2023-08-04 22:22:47 +08:00
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.SceneQuantityRankResponseDO">
|
2023-06-16 17:38:19 +08:00
|
|
|
select group_name, scene_name, count(*) as total
|
2023-01-14 20:46:02 +08:00
|
|
|
from retry_task_log
|
|
|
|
<where>
|
|
|
|
<if test="groupName != '' and groupName != null">
|
2023-06-16 17:38:19 +08:00
|
|
|
and group_name = #{groupName}
|
2023-01-14 20:46:02 +08:00
|
|
|
</if>
|
2023-01-14 20:46:11 +08:00
|
|
|
and create_dt >= #{startTime} and create_dt <= #{endTime}
|
2023-01-14 20:46:02 +08:00
|
|
|
</where>
|
|
|
|
group by group_name, scene_name
|
2023-06-16 17:38:19 +08:00
|
|
|
order by total desc
|
|
|
|
|
2023-01-14 20:46:02 +08:00
|
|
|
</select>
|
|
|
|
<select id="lineDispatchQuantity"
|
2023-08-04 22:22:47 +08:00
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DispatchQuantityResponseDO">
|
2023-01-14 20:46:11 +08:00
|
|
|
select
|
|
|
|
<choose>
|
|
|
|
<when test="type == 'day'">
|
2023-08-04 22:22:47 +08:00
|
|
|
TO_CHAR(create_dt,'%H')
|
2023-01-14 20:46:11 +08:00
|
|
|
</when>
|
|
|
|
<when test="type == 'week'">
|
2023-08-04 22:22:47 +08:00
|
|
|
TO_CHAR(create_dt,'%Y-%m-%d')
|
2023-01-14 20:46:11 +08:00
|
|
|
</when>
|
|
|
|
<when test="type =='month'">
|
2023-08-04 22:22:47 +08:00
|
|
|
TO_CHAR(create_dt,'%Y-%m-%d')
|
2023-01-14 20:46:11 +08:00
|
|
|
</when>
|
|
|
|
<when test="type == 'year'">
|
2023-08-04 22:22:47 +08:00
|
|
|
TO_CHAR(create_dt,'%Y-%m')
|
2023-01-14 20:46:11 +08:00
|
|
|
</when>
|
|
|
|
<otherwise>
|
2023-08-04 22:22:47 +08:00
|
|
|
TO_CHAR(create_dt,'%Y-%m-%d')
|
2023-01-14 20:46:11 +08:00
|
|
|
</otherwise>
|
|
|
|
</choose>
|
2023-06-16 17:38:19 +08:00
|
|
|
as createDt, count(*) as total
|
2023-01-14 20:46:11 +08:00
|
|
|
from retry_task_log
|
|
|
|
<where>
|
|
|
|
<if test="groupName != '' and groupName != null">
|
|
|
|
group_name = #{groupName}
|
|
|
|
</if>
|
|
|
|
<if test="retryStatus!=null ">
|
2023-06-16 17:38:19 +08:00
|
|
|
and retry_status = #{retryStatus}
|
2023-01-14 20:46:11 +08:00
|
|
|
</if>
|
|
|
|
|
|
|
|
and create_dt >= #{startTime} and create_dt <= #{endTime}
|
|
|
|
</where>
|
2023-06-16 17:38:19 +08:00
|
|
|
group by createDt
|
|
|
|
order by total desc
|
|
|
|
|
|
|
|
|
2023-01-14 20:46:02 +08:00
|
|
|
</select>
|
2023-07-16 22:58:54 +08:00
|
|
|
|
|
|
|
<!-- 定义批量新增的 SQL 映射 -->
|
|
|
|
<insert id="batchInsert" parameterType="java.util.List">
|
2023-07-17 23:36:15 +08:00
|
|
|
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)
|
2023-07-16 22:58:54 +08:00
|
|
|
VALUES
|
|
|
|
<foreach collection="list" item="item" separator=",">
|
2023-07-17 23:36:15 +08:00
|
|
|
(#{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId}, #{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs}, #{item.taskType}, #{item.createDt})
|
2023-07-16 22:58:54 +08:00
|
|
|
</foreach>
|
|
|
|
</insert>
|
2023-01-14 21:02:18 +08:00
|
|
|
</mapper>
|