2023-12-10 23:58:49 +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.template.datasource.persistence.mapper.RetrySummaryMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary">
|
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
|
<result column="namespace_id" jdbcType="TINYINT" property="namespaceId"/>
|
|
|
|
<result column="group_name" jdbcType="TINYINT" property="groupName"/>
|
|
|
|
<result column="scene_name" jdbcType="TINYINT" property="sceneName"/>
|
|
|
|
<result column="trigger_at" jdbcType="TIMESTAMP" property="triggerAt"/>
|
|
|
|
<result column="running_num" jdbcType="TINYINT" property="runningNum"/>
|
|
|
|
<result column="finish_num" jdbcType="TINYINT" property="finishNum"/>
|
|
|
|
<result column="max_count_num" jdbcType="VARCHAR" property="maxCountNum"/>
|
|
|
|
<result column="suspend_num" jdbcType="TINYINT" property="suspendNum"/>
|
|
|
|
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
|
|
|
<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)
|
|
|
|
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`)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<select id="retryTask"
|
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
|
|
|
SELECT ifnull(sum(running_num), 0) AS runningNum,
|
|
|
|
ifnull(sum(finish_num), 0) AS finishNum,
|
|
|
|
ifnull(sum(max_count_num), 0) AS maxCountNum,
|
|
|
|
ifnull(sum(suspend_num), 0) AS suspendNum,
|
|
|
|
ifnull(sum(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum
|
|
|
|
FROM retry_summary
|
2024-03-28 13:39:31 +08:00
|
|
|
${ew.customSqlSegment}
|
2023-12-10 23:58:49 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="retryTaskBarList"
|
2024-01-09 14:15:19 +08:00
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
|
|
|
SELECT
|
|
|
|
trigger_at, running_num, finish_num, max_count_num, suspend_num
|
|
|
|
FROM retry_summary
|
2024-03-28 13:39:31 +08:00
|
|
|
${ew.customSqlSegment}
|
|
|
|
LIMIT 7
|
2023-12-10 23:58:49 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="retryLineList"
|
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
|
|
|
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,
|
|
|
|
ifnull(SUM(finish_num), 0) AS successNum,
|
|
|
|
ifnull(SUM(running_num), 0) AS runningNum,
|
|
|
|
ifnull(SUM(max_count_num), 0) AS maxCountNum,
|
|
|
|
ifnull(SUM(suspend_num), 0) AS suspendNum,
|
|
|
|
ifnull(SUM(finish_num + running_num + max_count_num + suspend_num), 0) AS total
|
|
|
|
FROM retry_summary
|
2024-03-28 13:39:31 +08:00
|
|
|
${ew.customSqlSegment}
|
2023-12-10 23:58:49 +08:00
|
|
|
GROUP BY createDt
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="dashboardRank"
|
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank">
|
|
|
|
SELECT
|
|
|
|
CONCAT(group_name, '/', scene_name) `name`,
|
2024-03-28 13:39:31 +08:00
|
|
|
SUM(running_num + finish_num + max_count_num + suspend_num) AS total
|
|
|
|
FROM retry_summary
|
|
|
|
${ew.customSqlSegment}
|
2023-12-10 23:58:49 +08:00
|
|
|
HAVING total > 0
|
|
|
|
ORDER BY total DESC LIMIT 10
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="retryTaskList"
|
|
|
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
|
|
|
SELECT group_name AS groupName,
|
|
|
|
sum(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run,
|
|
|
|
count(*) AS total
|
|
|
|
FROM scene_config
|
|
|
|
WHERE namespace_id = #{namespaceId}
|
2024-03-28 13:39:31 +08:00
|
|
|
${ew.customSqlSegment}
|
2023-12-10 23:58:49 +08:00
|
|
|
GROUP BY namespace_id, group_name
|
|
|
|
</select>
|
|
|
|
</mapper>
|