From aebf104ff878dabf7072f219e54eabe655bace0e Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Mon, 14 Apr 2025 18:18:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=9A=E4=B8=AA=E9=82=AE=E4=BB=B6=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1399118465826816]支持配置多个邮件服务器 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1399118465826816 --- .../dao/mapper/NotifyConfigMapper.java | 15 +++ .../dao/mapper/NotifyConfigMapper.xml | 70 +++++++++++++- .../neatlogic/framework/dto/MailServerVo.java | 38 +++++--- .../framework/dto/NotifyConfigVo.java | 95 +++++++++++++++++++ .../changelog/2025-04-14/neatlogic_tenant.sql | 12 +++ .../changelog/2025-04-14/version.json | 12 +++ 6 files changed, 229 insertions(+), 13 deletions(-) create mode 100644 src/main/java/neatlogic/framework/dto/NotifyConfigVo.java create mode 100644 src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql create mode 100644 src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/version.json diff --git a/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.java b/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.java index 8d3b3de1d..fa03437b3 100644 --- a/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.java +++ b/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.java @@ -16,11 +16,26 @@ along with this program. If not, see .*/ package neatlogic.framework.dao.mapper; +import neatlogic.framework.dto.NotifyConfigVo; import org.apache.ibatis.annotations.Param; +import java.util.List; + public interface NotifyConfigMapper { + List getNotifyConfigListByType(String type); + + NotifyConfigVo getNotifyConfigById(Long id); + String getConfigByType(String type); int insertNotifyConfig(@Param("type") String type, @Param("config") String config); + + int insertNotifyConfigVo(NotifyConfigVo notifyConfigVo); + + int updateNotifyConfigIsActive(@Param("id") Long id, @Param("isActive") Integer isActive); + + int updateNotifyConfigIsDefault(@Param("id") Long id, @Param("isDefault") Integer isDefault); + + int deleteNotifyConfigById(Long id); } diff --git a/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.xml b/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.xml index 9b95989e9..3d66e272f 100644 --- a/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.xml +++ b/src/main/java/neatlogic/framework/dao/mapper/NotifyConfigMapper.xml @@ -17,8 +17,32 @@ along with this program. If not, see .--> + + + + @@ -27,4 +51,48 @@ along with this program. If not, see .--> ON DUPLICATE KEY UPDATE `config` = #{config} + + + INSERT INTO `notify_config` ( + `id`, + `name`, + `is_active`, + `is_default`, + `type`, + `config` + ) + VALUES + ( + #{id}, + #{name}, + #{isActive}, + #{isDefault}, + #{type}, + #{configStr, typeHandler=CompressHandler} + ) + ON DUPLICATE KEY UPDATE + `name` = #{name}, + `config` = #{configStr, typeHandler=CompressHandler} + + + + UPDATE `notify_config` + SET + `is_active` = #{isActive} + WHERE `id` = #{id} + + + + UPDATE `notify_config` + SET + + `is_active` = 1, + + `is_default` = #{isDefault} + WHERE `id` = #{id} + + + + DELETE FROM `notify_config` WHERE `id` = #{value} + diff --git a/src/main/java/neatlogic/framework/dto/MailServerVo.java b/src/main/java/neatlogic/framework/dto/MailServerVo.java index 5ad764a3a..bd13ede00 100644 --- a/src/main/java/neatlogic/framework/dto/MailServerVo.java +++ b/src/main/java/neatlogic/framework/dto/MailServerVo.java @@ -3,9 +3,6 @@ package neatlogic.framework.dto; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.common.dto.BasePageVo; import neatlogic.framework.restful.annotation.EntityField; -import org.apache.commons.lang3.StringUtils; - -import java.util.UUID; /** * @program: neatlogic @@ -16,8 +13,8 @@ public class MailServerVo extends BasePageVo { private static final long serialVersionUID = 6550790567158161414L; - @EntityField(name = "common.uuid", type = ApiParamType.STRING) - private String uuid; + @EntityField(name = "common.id", type = ApiParamType.LONG) + private Long id; @EntityField(name = "common.name", type = ApiParamType.STRING) private String name; @@ -42,16 +39,17 @@ public class MailServerVo extends BasePageVo { @EntityField(name = "common.homeurl", type = ApiParamType.STRING) private String homeUrl; + @EntityField(name = "common.isactive", type = ApiParamType.INTEGER) + private Integer isActive; + @EntityField(name = "common.isdefault", type = ApiParamType.INTEGER) + private Integer isDefault; - public String getUuid() { - if (StringUtils.isBlank(uuid)) { - uuid = UUID.randomUUID().toString().replace("-", ""); - } - return uuid; + public Long getId() { + return id; } - public void setUuid(String uuid) { - this.uuid = uuid; + public void setId(Long id) { + this.id = id; } public String getName() { @@ -117,4 +115,20 @@ public class MailServerVo extends BasePageVo { public void setHomeUrl(String homeUrl) { this.homeUrl = homeUrl; } + + public Integer getIsActive() { + return isActive; + } + + public void setIsActive(Integer isActive) { + this.isActive = isActive; + } + + public Integer getIsDefault() { + return isDefault; + } + + public void setIsDefault(Integer isDefault) { + this.isDefault = isDefault; + } } diff --git a/src/main/java/neatlogic/framework/dto/NotifyConfigVo.java b/src/main/java/neatlogic/framework/dto/NotifyConfigVo.java new file mode 100644 index 000000000..2620022bb --- /dev/null +++ b/src/main/java/neatlogic/framework/dto/NotifyConfigVo.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.dto; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.annotation.JSONField; + +public class NotifyConfigVo { + private Long id; + private String name; + private Integer isActive; + private Integer isDefault; + private String type; + private JSONObject config; + @JSONField(serialize = false) + private String configStr; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getIsActive() { + return isActive; + } + + public void setIsActive(Integer isActive) { + this.isActive = isActive; + } + + public Integer getIsDefault() { + return isDefault; + } + + public void setIsDefault(Integer isDefault) { + this.isDefault = isDefault; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public JSONObject getConfig() { + if (config == null && configStr != null) { + config = JSON.parseObject(configStr); + } + return config; + } + + public void setConfig(JSONObject config) { + this.config = config; + } + + public String getConfigStr() { + if (configStr == null && config != null) { + configStr = config.toJSONString(); + } + return configStr; + } + + public void setConfigStr(String configStr) { + this.configStr = configStr; + } +} diff --git a/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql b/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql new file mode 100644 index 000000000..6c626e4cb --- /dev/null +++ b/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql @@ -0,0 +1,12 @@ +ALTER TABLE `notify_config` + ADD COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID' FIRST, + ADD COLUMN `name` VARCHAR (250) NULL COMMENT '名称' AFTER `id`, + ADD COLUMN `is_active` TINYINT (1) DEFAULT 1 NOT NULL COMMENT '是否激活' AFTER `name`, + ADD COLUMN `is_default` TINYINT (1) DEFAULT 1 NOT NULL COMMENT '是否是默认配置' AFTER `is_active`, + DROP PRIMARY KEY, + ADD PRIMARY KEY (`id`); + +ALTER TABLE `neatlogic_develop`.`notify_config` + CHANGE `id` `id` BIGINT NOT NULL COMMENT '主键ID', + CHANGE `is_active` `is_active` TINYINT (1) DEFAULT 0 NOT NULL COMMENT '是否激活', + CHANGE `is_default` `is_default` TINYINT (1) DEFAULT 0 NOT NULL COMMENT '是否是默认配置' \ No newline at end of file diff --git a/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/version.json b/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/version.json new file mode 100644 index 000000000..6152c80d2 --- /dev/null +++ b/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/version.json @@ -0,0 +1,12 @@ +{ + "content": [ + { + "type": "功能添加", + "detail": [ + { + "msg": "1.支持配置多个邮件服务器" + } + ] + } + ] +} -- Gitee From 07e8a422360cb25d5b323ac31ca772e2ebaa427a Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Mon, 14 Apr 2025 18:24:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=9A=E4=B8=AA=E9=82=AE=E4=BB=B6=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1399118465826816]支持配置多个邮件服务器 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1399118465826816 --- .../changelog/2025-04-14/neatlogic_tenant.sql | 4 ++-- .../resources/framework/sqlscript/ddl.sql | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql b/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql index 6c626e4cb..f65fe49cd 100644 --- a/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql +++ b/src/main/resources/neatlogic/resources/framework/changelog/2025-04-14/neatlogic_tenant.sql @@ -6,7 +6,7 @@ ALTER TABLE `notify_config` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`); -ALTER TABLE `neatlogic_develop`.`notify_config` +ALTER TABLE `notify_config` CHANGE `id` `id` BIGINT NOT NULL COMMENT '主键ID', CHANGE `is_active` `is_active` TINYINT (1) DEFAULT 0 NOT NULL COMMENT '是否激活', - CHANGE `is_default` `is_default` TINYINT (1) DEFAULT 0 NOT NULL COMMENT '是否是默认配置' \ No newline at end of file + CHANGE `is_default` `is_default` TINYINT (1) DEFAULT 0 NOT NULL COMMENT '是否是默认配置'; \ No newline at end of file diff --git a/src/main/resources/neatlogic/resources/framework/sqlscript/ddl.sql b/src/main/resources/neatlogic/resources/framework/sqlscript/ddl.sql index 201c871fc..8987dc4f7 100644 --- a/src/main/resources/neatlogic/resources/framework/sqlscript/ddl.sql +++ b/src/main/resources/neatlogic/resources/framework/sqlscript/ddl.sql @@ -947,14 +947,15 @@ CREATE TABLE `mq_topic` -- ---------------------------- -- Table structure for notify_config -- ---------------------------- -CREATE TABLE IF NOT EXISTS `notify_config` -( - `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通知类型', - `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置', - PRIMARY KEY (`type`) USING BTREE -) ENGINE = InnoDB - CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_general_ci COMMENT = '通知配置表'; +CREATE TABLE `notify_config` ( + `id` bigint NOT NULL COMMENT '主键ID', + `name` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称', + `is_active` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否激活', + `is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否是默认配置', + `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通知类型', + `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='通知配置表'; -- ---------------------------- -- Table structure for notify_job -- Gitee