From 755ed044d732852220d5002992bc822bb7c9011d Mon Sep 17 00:00:00 2001 From: opensnail <598092184@qq.com> Date: Thu, 18 Apr 2024 23:31:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.0.0):=20=E5=AE=8C=E6=88=90=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/sql/snail_job_mysql.sql | 44 +++++++++---------- .../impl/NotifyRecipientServiceImpl.java | 6 +-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/sql/snail_job_mysql.sql b/doc/sql/snail_job_mysql.sql index a38126f9..e46a22b5 100644 --- a/doc/sql/snail_job_mysql.sql +++ b/doc/sql/snail_job_mysql.sql @@ -48,21 +48,21 @@ CREATE TABLE `sj_group_config` CREATE TABLE `sj_notify_config` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id', - `group_name` varchar(64) NOT NULL COMMENT '组名称', - `business_id` varchar(64) NOT NULL COMMENT '业务id (job_id或workflow_id或scene_name)', - `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务', - `notify_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知状态 0、未启用 1、启用', - `recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表', - `notify_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '通知阈值', - `notify_scene` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知场景', - `rate_limiter_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '限流状态 0、未启用 1、启用', - `rate_limiter_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '每秒限流阈值', - `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述', - `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id', + `group_name` varchar(64) NOT NULL COMMENT '组名称', + `business_id` varchar(64) NOT NULL COMMENT '业务id (job_id或workflow_id或scene_name)', + `system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务', + `notify_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知状态 0、未启用 1、启用', + `recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表', + `notify_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '通知阈值', + `notify_scene` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知场景', + `rate_limiter_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '限流状态 0、未启用 1、启用', + `rate_limiter_threshold` int(11) NOT NULL DEFAULT 0 COMMENT '每秒限流阈值', + `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述', + `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`), - KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `business_id`) + KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `business_id`) ) ENGINE = InnoDB AUTO_INCREMENT = 0 DEFAULT CHARSET = utf8mb4 COMMENT ='通知配置' @@ -71,15 +71,15 @@ CREATE TABLE `sj_notify_config` CREATE TABLE `sj_notify_recipient` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', - `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id', - `recipient_name` varchar(64) NOT NULL COMMENT '接收人名称', - `notify_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书', - `notify_attribute` varchar(512) NOT NULL COMMENT '配置属性', - `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述', - `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id', + `recipient_name` varchar(64) NOT NULL COMMENT '接收人名称', + `notify_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书', + `notify_attribute` varchar(512) NOT NULL COMMENT '配置属性', + `description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述', + `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`), - KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`) + KEY `idx_namespace_id` (`namespace_id`) ) ENGINE = InnoDB AUTO_INCREMENT = 0 DEFAULT CHARSET = utf8mb4 COMMENT ='告警通知接收人' diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyRecipientServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyRecipientServiceImpl.java index 129ea84a..18d8df89 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyRecipientServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyRecipientServiceImpl.java @@ -1,6 +1,5 @@ package com.aizuda.snailjob.server.web.service.impl; -import cn.hutool.core.lang.Assert; import com.aizuda.snailjob.server.web.model.base.PageResult; import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO; import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO; @@ -29,8 +28,9 @@ public class NotifyRecipientServiceImpl implements NotifyRecipientService { @Override public PageResult> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) { PageDTO pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); - - PageDTO notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, new LambdaQueryWrapper<>()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByDesc(NotifyRecipient::getCreateDt); + PageDTO notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, queryWrapper); return new PageResult<>(pageDTO, NotifyRecipientConverter.INSTANCE.toNotifyRecipientResponseVOs(notifyRecipientPageDTO.getRecords())); }