style: 格式化SQL脚本
This commit is contained in:
parent
c70948c34a
commit
be9bdefc4d
@ -15,23 +15,24 @@
|
|||||||
<result column="create_dt" property="createDt"/>
|
<result column="create_dt" property="createDt"/>
|
||||||
<result column="real_time" property="realTime"/>
|
<result column="real_time" property="realTime"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 定义批量新增的 SQL 映射 -->
|
<!-- 定义批量新增的 SQL 映射 -->
|
||||||
<insert id="batchInsert" parameterType="java.util.List">
|
<insert id="batchInsert" parameterType="java.util.List">
|
||||||
INSERT INTO job_log_message (namespace_id, group_name, job_id, task_batch_id, task_id, log_num, message,
|
INSERT INTO job_log_message (namespace_id, group_name, job_id, task_batch_id, task_id, log_num, message,
|
||||||
create_dt, real_time)
|
create_dt, real_time)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.namespaceId},
|
#{item.namespaceId},
|
||||||
#{item.groupName},
|
#{item.groupName},
|
||||||
#{item.jobId},
|
#{item.jobId},
|
||||||
#{item.taskBatchId},
|
#{item.taskBatchId},
|
||||||
#{item.taskId},
|
#{item.taskId},
|
||||||
#{item.logNum},
|
#{item.logNum},
|
||||||
#{item.message},
|
#{item.message},
|
||||||
#{item.createDt},
|
#{item.createDt},
|
||||||
#{item.realTime}
|
#{item.realTime}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
USING (
|
USING (
|
||||||
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
<foreach collection="list" item="item" index="index" separator=" UNION ALL ">
|
||||||
SELECT
|
SELECT
|
||||||
#{item.nextTriggerAt} AS next_trigger_at,
|
#{item.nextTriggerAt} AS next_trigger_at,
|
||||||
#{item.id} AS id
|
#{item.id} AS id
|
||||||
FROM DUAL
|
FROM DUAL
|
||||||
</foreach>
|
</foreach>
|
||||||
) src
|
) src
|
||||||
|
@ -25,19 +25,21 @@
|
|||||||
<select id="selectJobNotifyConfigList"
|
<select id="selectJobNotifyConfigList"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigResponseDO">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigResponseDO">
|
||||||
SELECT a.*, b.job_name
|
SELECT a.*, b.job_name
|
||||||
FROM job_notify_config a join job b on a.job_id = b.id
|
FROM
|
||||||
|
job_notify_config a
|
||||||
|
JOIN job b ON a.job_id = b.id
|
||||||
<where>
|
<where>
|
||||||
a.namespace_id = #{queryDO.namespaceId}
|
a.namespace_id = #{queryDO.namespaceId}
|
||||||
<if test="queryDO.jobId != null">
|
<if test="queryDO.jobId != null">
|
||||||
and a.job_id = #{queryDO.jobId}
|
AND a.job_id = #{queryDO.jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||||
and a.group_name IN
|
AND a.group_name IN
|
||||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||||
#{groupName}
|
#{groupName}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
order by a.id desc
|
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.id DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
) src
|
) src
|
||||||
ON (dest.job_id = src.job_id AND dest.trigger_at = src.trigger_at)
|
ON (dest.job_id = src.job_id AND dest.trigger_at = src.trigger_at)
|
||||||
WHEN MATCHED THEN
|
WHEN MATCHED THEN
|
||||||
SET dest.success_num = src.success_num,
|
UPDATE SET
|
||||||
|
dest.success_num = src.success_num,
|
||||||
dest.fail_num = src.fail_num,
|
dest.fail_num = src.fail_num,
|
||||||
dest.fail_reason = src.fail_reason,
|
dest.fail_reason = src.fail_reason,
|
||||||
dest.stop_num = src.stop_num,
|
dest.stop_num = src.stop_num,
|
||||||
@ -47,7 +48,7 @@
|
|||||||
dest.cancel_num = src.cancel_num,
|
dest.cancel_num = src.cancel_num,
|
||||||
dest.cancel_reason = src.cancel_reason
|
dest.cancel_reason = src.cancel_reason
|
||||||
WHEN NOT MATCHED THEN
|
WHEN NOT MATCHED THEN
|
||||||
INSERT job_summary (namespace_id, group_name, job_id, trigger_at,
|
INSERT (namespace_id, group_name, job_id, trigger_at,
|
||||||
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
|
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
@ -167,7 +168,7 @@
|
|||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
||||||
SELECT group_name AS groupName,
|
SELECT group_name AS groupName,
|
||||||
SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run,
|
SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run,
|
||||||
count(*) AS total
|
COUNT(*) AS total
|
||||||
FROM job
|
FROM job
|
||||||
WHERE namespace_id = #{namespaceId}
|
WHERE namespace_id = #{namespaceId}
|
||||||
<if test="groupNames != null and groupNames.size > 0">
|
<if test="groupNames != null and groupNames.size > 0">
|
||||||
|
@ -13,32 +13,34 @@
|
|||||||
<result column="update_dt" property="updateDt" />
|
<result column="update_dt" property="updateDt" />
|
||||||
<result column="deleted" property="deleted" />
|
<result column="deleted" property="deleted" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectJobBatchPageList"
|
<select id="selectJobBatchPageList"
|
||||||
parameterType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchQueryDO"
|
parameterType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchQueryDO"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO">
|
||||||
SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type
|
SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type
|
||||||
FROM job_task_batch a join job b on a.job_id = b.id
|
FROM job_task_batch a JOIN job b ON a.job_id = b.id
|
||||||
<where>
|
<where>
|
||||||
a.namespace_id = #{queryDO.namespaceId}
|
a.namespace_id = #{queryDO.namespaceId}
|
||||||
<if test="queryDO.jobId != null">
|
<if test="queryDO.jobId != null">
|
||||||
and a.job_id = #{queryDO.jobId}
|
AND a.job_id = #{queryDO.jobId}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||||
and a.group_name IN
|
AND a.group_name IN
|
||||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||||
#{groupName}
|
#{groupName}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.taskBatchStatus != null">
|
<if test="queryDO.taskBatchStatus != null">
|
||||||
and task_batch_status = #{queryDO.taskBatchStatus}
|
AND task_batch_status = #{queryDO.taskBatchStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.jobName != null">
|
<if test="queryDO.jobName != null">
|
||||||
and job_name like #{queryDO.jobName}
|
AND job_name LIKE #{queryDO.jobName}
|
||||||
</if>
|
</if>
|
||||||
and a.deleted = 0
|
AND a.deleted = 0
|
||||||
order by a.id desc
|
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="summaryJobBatchList"
|
<select id="summaryJobBatchList"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchSummaryResponseDO">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchSummaryResponseDO">
|
||||||
SELECT namespace_id AS namespaceId,
|
SELECT namespace_id AS namespaceId,
|
||||||
@ -54,18 +56,27 @@
|
|||||||
FROM job_task_batch
|
FROM job_task_batch
|
||||||
WHERE create_dt BETWEEN #{from} AND #{to}
|
WHERE create_dt BETWEEN #{from} AND #{to}
|
||||||
GROUP BY namespace_id, group_name, job_id, task_batch_status, operation_reason
|
GROUP BY namespace_id, group_name, job_id, task_batch_status, operation_reason
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectJobBatchListByIds"
|
<select id="selectJobBatchListByIds"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO">
|
||||||
SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type,b.executor_info,b.args_str
|
SELECT
|
||||||
FROM job_task_batch a join job b on a.job_id = b.id
|
a.*,
|
||||||
|
b.job_name,
|
||||||
|
b.task_type,
|
||||||
|
b.block_strategy,
|
||||||
|
b.trigger_type,
|
||||||
|
b.executor_info,
|
||||||
|
b.args_str
|
||||||
|
FROM
|
||||||
|
job_task_batch a
|
||||||
|
JOIN job b ON a.job_id = b.id
|
||||||
<where>
|
<where>
|
||||||
a.id in
|
a.id IN
|
||||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
and a.deleted = 0
|
AND a.deleted = 0
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -15,25 +15,31 @@
|
|||||||
<result column="task_type" jdbcType="TINYINT" property="taskType"/>
|
<result column="task_type" jdbcType="TINYINT" property="taskType"/>
|
||||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, namespace_id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, create_dt, task_type
|
id, namespace_id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, create_dt, task_type
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="insertBatch">
|
<insert id="insertBatch">
|
||||||
insert into retry_dead_letter (namespace_id, unique_id, group_name, scene_name,
|
INSERT INTO retry_dead_letter (namespace_id, unique_id, group_name, scene_name,
|
||||||
idempotent_id, biz_no, executor_name, args_str,
|
idempotent_id, biz_no, executor_name, args_str,
|
||||||
ext_attrs, create_dt
|
ext_attrs, create_dt)
|
||||||
)
|
VALUES
|
||||||
values
|
<foreach collection="retryDeadLetters" item="retryDeadLetter" separator=",">
|
||||||
<foreach collection="retryDeadLetters" item="retryDeadLetter" separator=",">
|
(
|
||||||
(#{retryDeadLetter.namespaceId,jdbcType=VARCHAR}, #{retryDeadLetter.uniqueId,jdbcType=VARCHAR}, #{retryDeadLetter.groupName,jdbcType=VARCHAR}, #{retryDeadLetter.sceneName,jdbcType=VARCHAR},
|
#{retryDeadLetter.namespaceId,jdbcType=VARCHAR}, #{retryDeadLetter.uniqueId,jdbcType=VARCHAR},
|
||||||
#{retryDeadLetter.idempotentId,jdbcType=VARCHAR}, #{retryDeadLetter.bizNo,jdbcType=VARCHAR}, #{retryDeadLetter.executorName,jdbcType=VARCHAR}, #{retryDeadLetter.argsStr,jdbcType=VARCHAR},
|
#{retryDeadLetter.groupName,jdbcType=VARCHAR}, #{retryDeadLetter.sceneName,jdbcType=VARCHAR},
|
||||||
#{retryDeadLetter.extAttrs,jdbcType=VARCHAR}, #{retryDeadLetter.createDt,jdbcType=TIMESTAMP})
|
#{retryDeadLetter.idempotentId,jdbcType=VARCHAR}, #{retryDeadLetter.bizNo,jdbcType=VARCHAR},
|
||||||
</foreach>
|
#{retryDeadLetter.executorName,jdbcType=VARCHAR}, #{retryDeadLetter.argsStr,jdbcType=VARCHAR},
|
||||||
|
#{retryDeadLetter.extAttrs,jdbcType=VARCHAR}, #{retryDeadLetter.createDt,jdbcType=TIMESTAMP}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="countRetryDeadLetterByCreateAt" resultType="int">
|
<select id="countRetryDeadLetterByCreateAt" resultType="int">
|
||||||
select
|
SELECT COUNT(*)
|
||||||
count(*)
|
FROM retry_dead_letter_${partition}
|
||||||
from retry_dead_letter_${partition} where create_dt>= #{startTime} and create_dt <=#{endTime}
|
WHERE create_dt BETWEEN #{startTime} AND #{endTime}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -36,25 +36,25 @@
|
|||||||
AND dest.scene_name = src.scene_name
|
AND dest.scene_name = src.scene_name
|
||||||
AND dest.trigger_at = src.trigger_at)
|
AND dest.trigger_at = src.trigger_at)
|
||||||
WHEN MATCHED THEN
|
WHEN MATCHED THEN
|
||||||
SET dest.running_num = src.running_num,
|
UPDATE SET
|
||||||
|
dest.running_num = src.running_num,
|
||||||
dest.finish_num = src.finish_num,
|
dest.finish_num = src.finish_num,
|
||||||
dest.max_count_num = src.max_count_num,
|
dest.max_count_num = src.max_count_num,
|
||||||
dest.suspend_num = src.suspend_num
|
dest.suspend_num = src.suspend_num
|
||||||
WHEN NOT MATCHED THEN
|
WHEN NOT MATCHED THEN
|
||||||
INSERT
|
INSERT (namespace_id, group_name, scene_name, trigger_at,
|
||||||
retry_summary (namespace_id, group_name, scene_name, trigger_at,
|
running_num, finish_num, max_count_num, suspend_num)
|
||||||
running_num, finish_num, max_count_num, suspend_num)
|
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.namespaceId},
|
#{item.namespaceId},
|
||||||
#{item.groupName},
|
#{item.groupName},
|
||||||
#{item.sceneName},
|
#{item.sceneName},
|
||||||
#{item.triggerAt},
|
#{item.triggerAt},
|
||||||
#{item.runningNum},
|
#{item.runningNum},
|
||||||
#{item.finishNum},
|
#{item.finishNum},
|
||||||
#{item.maxCountNum},
|
#{item.maxCountNum},
|
||||||
#{item.suspendNum}
|
#{item.suspendNum}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
@ -16,20 +16,23 @@
|
|||||||
<result column="task_type" jdbcType="TINYINT" property="taskType"/>
|
<result column="task_type" jdbcType="TINYINT" property="taskType"/>
|
||||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id
|
id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, retry_status,
|
||||||
, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, retry_status,
|
create_dt, task_type, namespace_id
|
||||||
create_dt, task_type, namespace_id
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 定义批量新增的 SQL 映射 -->
|
<!-- 定义批量新增的 SQL 映射 -->
|
||||||
<insert id="batchInsert" parameterType="java.util.List">
|
<insert id="batchInsert" parameterType="java.util.List">
|
||||||
INSERT INTO retry_task_log (unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name,
|
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)
|
args_str, ext_attrs, task_type, create_dt, namespace_id)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId},
|
(
|
||||||
#{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs},
|
#{item.uniqueId}, #{item.groupName}, #{item.sceneName}, #{item.idempotentId},
|
||||||
#{item.taskType}, #{item.createDt}, #{item.namespaceId})
|
#{item.bizNo}, #{item.executorName}, #{item.argsStr}, #{item.extAttrs},
|
||||||
|
#{item.taskType}, #{item.createDt}, #{item.namespaceId}
|
||||||
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -19,16 +19,23 @@
|
|||||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
||||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
|
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
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,
|
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,
|
||||||
create_dt, update_dt, task_type
|
create_dt, update_dt, task_type
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 定义批量新增的 SQL 映射 -->
|
<!-- 定义批量新增的 SQL 映射 -->
|
||||||
<insert id="batchInsert" parameterType="java.util.List">
|
<insert id="batchInsert" parameterType="java.util.List">
|
||||||
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)
|
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)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{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})
|
(
|
||||||
|
#{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}
|
||||||
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
||||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
|
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, scene_name, group_name, scene_status, max_retry_count, back_off, trigger_interval, deadline_request, description, create_dt, update_dt
|
id, scene_name, group_name, scene_status, max_retry_count, back_off, trigger_interval, deadline_request, description, create_dt, update_dt
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
|
|
||||||
<update id="updateMaxIdByCustomStep">
|
<update id="updateMaxIdByCustomStep">
|
||||||
UPDATE sequence_alloc
|
UPDATE sequence_alloc
|
||||||
SET max_id = max_id + #{step}, update_dt = now()
|
SET max_id = max_id + #{step}, update_dt = CURRENT_TIMESTAMP
|
||||||
WHERE group_name = #{groupName} and namespace_id = #{namespaceId}
|
WHERE group_name = #{groupName} AND namespace_id = #{namespaceId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateMaxId">
|
<update id="updateMaxId">
|
||||||
UPDATE sequence_alloc
|
UPDATE sequence_alloc
|
||||||
SET max_id = max_id + step, update_dt = now()
|
SET max_id = max_id + step, update_dt = CURRENT_TIMESTAMP
|
||||||
WHERE group_name = #{groupName} and namespace_id = #{namespaceId}
|
WHERE group_name = #{groupName} AND namespace_id = #{namespaceId}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -47,26 +47,29 @@
|
|||||||
VALUES
|
VALUES
|
||||||
<foreach collection="records" item="item" index="index" separator=",">
|
<foreach collection="records" item="item" index="index" separator=",">
|
||||||
(#{item.namespaceId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR}, #{item.hostId,jdbcType=VARCHAR}, #{item.hostIp,jdbcType=VARCHAR},
|
(#{item.namespaceId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR}, #{item.hostId,jdbcType=VARCHAR}, #{item.hostIp,jdbcType=VARCHAR},
|
||||||
#{item.hostPort,jdbcType=INTEGER}, #{item.expireAt,jdbcType=TIMESTAMP}, #{item.nodeType,jdbcType=TINYINT},
|
#{item.hostPort,jdbcType=INTEGER}, #{item.expireAt,jdbcType=TIMESTAMP}, #{item.nodeType,jdbcType=TINYINT},
|
||||||
#{item.extAttrs,jdbcType=VARCHAR}, #{item.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP})
|
#{item.extAttrs,jdbcType=VARCHAR}, #{item.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP})
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<delete id="deleteByExpireAt">
|
<delete id="deleteByExpireAt">
|
||||||
delete
|
DELETE
|
||||||
from server_node
|
FROM server_node
|
||||||
where expire_at <= #{endTime,jdbcType=TIMESTAMP}
|
WHERE expire_at <= #{endTime,jdbcType=TIMESTAMP}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="countActivePod"
|
<select id="countActivePod"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||||
SELECT node_type as nodeType, count(*) as total
|
SELECT
|
||||||
from server_node where namespace_id in
|
node_type AS nodeType,
|
||||||
<foreach collection="namespaceIds" item="namespaceId" separator="," open="(" close=")">
|
COUNT(*) AS total
|
||||||
#{namespaceId}
|
FROM server_node
|
||||||
</foreach>
|
WHERE namespace_id IN
|
||||||
GROUP BY node_type
|
<foreach collection="namespaceIds" item="namespaceId" separator="," open="(" close=")">
|
||||||
|
#{namespaceId}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY node_type
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
) src
|
) src
|
||||||
ON (dest.id = src.id)
|
ON (dest.id = src.id)
|
||||||
WHEN MATCHED THEN
|
WHEN MATCHED THEN
|
||||||
UPDATE SET dest.next_trigger_at = src.next_trigger_at
|
UPDATE SET
|
||||||
|
dest.next_trigger_at = src.next_trigger_at
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -16,31 +16,33 @@
|
|||||||
<result column="deleted" property="deleted"/>
|
<result column="deleted" property="deleted"/>
|
||||||
<result column="ext_attrs" property="extAttrs"/>
|
<result column="ext_attrs" property="extAttrs"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectWorkflowBatchPageList"
|
<select id="selectWorkflowBatchPageList"
|
||||||
parameterType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.WorkflowBatchQueryDO"
|
parameterType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.WorkflowBatchQueryDO"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.WorkflowBatchResponseDO">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.WorkflowBatchResponseDO">
|
||||||
SELECT a.*, b.workflow_name
|
SELECT a.*, b.workflow_name
|
||||||
FROM workflow_task_batch a join workflow b on a.workflow_id = b.id
|
FROM workflow_task_batch a
|
||||||
|
JOIN workflow b ON a.workflow_id = b.id
|
||||||
<where>
|
<where>
|
||||||
a.namespace_id = #{queryDO.namespaceId}
|
a.namespace_id = #{queryDO.namespaceId}
|
||||||
<if test="queryDO.workflowId != null">
|
<if test="queryDO.workflowId != null">
|
||||||
and a.workflow_id = #{queryDO.workflowId}
|
AND a.workflow_id = #{queryDO.workflowId}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||||
and a.group_name IN
|
AND a.group_name IN
|
||||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||||
#{groupName}
|
#{groupName}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.taskBatchStatus != null">
|
<if test="queryDO.taskBatchStatus != null">
|
||||||
and task_batch_status = #{queryDO.taskBatchStatus}
|
AND task_batch_status = #{queryDO.taskBatchStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDO.workflowName != null">
|
<if test="queryDO.workflowName != null">
|
||||||
and b.workflow_name like #{queryDO.workflowName}
|
AND b.workflow_name LIKE #{queryDO.workflowName}
|
||||||
</if>
|
</if>
|
||||||
and a.deleted = 0
|
AND a.deleted = 0
|
||||||
order by a.id desc
|
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user