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

90 lines
3.7 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">
<mapper namespace="com.aizuda.easy.retry.server.persistence.mybatis.mapper.RetryTaskLogMapper">
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.server.persistence.mybatis.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"/>
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,
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(*)
from retry_task_log
2023-01-14 20:46:02 +08:00
</select>
<select id="countTaskByRetryStatus" resultType="java.lang.Long">
select count(*)
from retry_task_log
where retry_status = #{retryStatus}
2023-01-14 20:46:02 +08:00
</select>
<select id="rankSceneQuantity"
resultType="com.aizuda.easy.retry.server.web.model.response.SceneQuantityRankResponseVO">
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">
and group_name = #{groupName}
2023-01-14 20:46:02 +08:00
</if>
and create_dt >= #{startTime} and create_dt &lt;= #{endTime}
2023-01-14 20:46:02 +08:00
</where>
group by group_name, scene_name
order by total desc
2023-01-14 20:46:02 +08:00
</select>
<select id="lineDispatchQuantity"
resultType="com.aizuda.easy.retry.server.web.model.response.DispatchQuantityResponseVO">
select
<choose>
<when test="type == 'day'">
DATE_FORMAT(create_dt,'%H')
</when>
<when test="type == 'week'">
DATE_FORMAT(create_dt,'%Y-%m-%d')
</when>
<when test="type =='month'">
DATE_FORMAT(create_dt,'%Y-%m-%d')
</when>
<when test="type == 'year'">
DATE_FORMAT(create_dt,'%Y-%m')
</when>
<otherwise>
DATE_FORMAT(create_dt,'%Y-%m-%d')
</otherwise>
</choose>
as createDt, count(*) as total
from retry_task_log
<where>
<if test="groupName != '' and groupName != null">
group_name = #{groupName}
</if>
<if test="retryStatus!=null ">
and retry_status = #{retryStatus}
</if>
and create_dt >= #{startTime} and create_dt &lt;= #{endTime}
</where>
group by createDt
order by total desc
2023-01-14 20:46:02 +08:00
</select>
2023-01-14 21:02:18 +08:00
</mapper>