diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java index 1811bd1e..ddebe20e 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java @@ -34,16 +34,31 @@ public class TeamEnvironmentNotificationConfigDTO extends BaseDTO { */ private Boolean deployNotificationEnabled; + /** + * 部署通知模板ID + */ + private Long deployNotificationTemplateId; + /** * 是否启用构建通知 */ private Boolean buildNotificationEnabled; + /** + * 构建通知模板ID + */ + private Long buildNotificationTemplateId; + /** * 构建失败时是否发送日志文件到企业微信 */ private Boolean buildFailureFileEnabled; + /** + * 构建失败通知模板ID + */ + private Long buildFailureNotificationTemplateId; + // ===== 扩展字段(非数据库字段) ===== /** diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java index 61854df7..92a1d227 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java @@ -25,18 +25,36 @@ public class UserTeamEnvironmentNotificationConfigDTO { @Schema(description = "是否启用部署通知") private Boolean deployNotificationEnabled; + /** + * 部署通知模板ID + */ + @Schema(description = "部署通知模板ID") + private Long deployNotificationTemplateId; + /** * 是否启用构建通知 */ @Schema(description = "是否启用构建通知") private Boolean buildNotificationEnabled; + /** + * 构建通知模板ID + */ + @Schema(description = "构建通知模板ID") + private Long buildNotificationTemplateId; + /** * 构建失败时是否发送日志文件到企业微信 */ @Schema(description = "构建失败时是否发送日志文件到企业微信") private Boolean buildFailureFileEnabled; + /** + * 构建失败通知模板ID + */ + @Schema(description = "构建失败通知模板ID") + private Long buildFailureNotificationTemplateId; + // ===== 扩展字段(非数据库字段) ===== /** diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentConfig.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentConfig.java index ee8c5866..f2d948b3 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentConfig.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentConfig.java @@ -13,14 +13,14 @@ import java.util.List; /** * 团队环境配置实体 - * + * *
定义团队对特定环境的配置: *
数据迁移说明: * 本表由 deploy_team_config 重构而来,将原来的 JSON 数组结构展开为标准表结构: *
@@ -39,7 +39,7 @@ import java.util.List; public class TeamEnvironmentConfig extends Entity{ // ===== 关联关系 ===== - + /** * 团队ID */ @@ -53,7 +53,7 @@ public class TeamEnvironmentConfig extends Entity { private Long environmentId; // ===== 审批配置 ===== - + /** * 是否需要审批 * 对应原 TeamConfig.environmentApprovalRequired[i] @@ -70,23 +70,7 @@ public class TeamEnvironmentConfig extends Entity
{ @Column(name = "approver_user_ids", columnDefinition = "JSON") private List approverUserIds; - // ===== 通知配置 ===== - - /** - * 通知渠道ID - * 关联 sys_notification_channel 表 - */ - @Column(name = "notification_channel_id") - private Long notificationChannelId; - /** - * 是否启用部署通知 - */ - @Column(name = "notification_enabled", nullable = false, columnDefinition = "BOOLEAN DEFAULT TRUE") - private Boolean notificationEnabled = true; - - // ===== 安全策略 ===== - /** * 是否要求代码审查通过才能部署 */ @@ -94,7 +78,7 @@ public class TeamEnvironmentConfig extends Entity
{ private Boolean requireCodeReview = false; // ===== 备注 ===== - + /** * 备注信息 */ diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java index 37d7d382..1b6fe0fc 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java @@ -51,15 +51,33 @@ public class TeamEnvironmentNotificationConfig extends Entity { @Column(name = "deploy_notification_enabled", nullable = false, columnDefinition = "BIT DEFAULT 1") private Boolean deployNotificationEnabled = true; + /** + * 部署通知模板ID(关联sys_notification_template) + */ + @Column(name = "deploy_notification_template_id") + private Long deployNotificationTemplateId; + /** * 是否启用构建通知 */ @Column(name = "build_notification_enabled", nullable = false) private Boolean buildNotificationEnabled = false; + /** + * 构建通知模板ID(关联sys_notification_template) + */ + @Column(name = "build_notification_template_id") + private Long buildNotificationTemplateId; + /** * 构建失败时是否发送日志文件到企业微信 */ @Column(name = "build_failure_file_enabled", nullable = false) private Boolean buildFailureFileEnabled = false; + + /** + * 构建失败通知模板ID(关联sys_notification_template) + */ + @Column(name = "build_failure_notification_template_id") + private Long buildFailureNotificationTemplateId; } diff --git a/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql b/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql index fb755205..5567cce2 100644 --- a/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql +++ b/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql @@ -869,13 +869,16 @@ CREATE TABLE deploy_team_environment_notification_config version INT NOT NULL DEFAULT 1 COMMENT '版本号', deleted BIT NOT NULL DEFAULT 0 COMMENT '是否删除', - team_id BIGINT NOT NULL COMMENT '团队ID', - environment_id BIGINT NOT NULL COMMENT '环境ID', + team_id BIGINT NOT NULL COMMENT '团队ID', + environment_id BIGINT NOT NULL COMMENT '环境ID', - notification_channel_id BIGINT NULL COMMENT '通知渠道ID(关联sys_notification_channel)', - deploy_notification_enabled BIT NOT NULL DEFAULT 1 COMMENT '是否启用部署通知', - build_notification_enabled BIT NOT NULL DEFAULT 0 COMMENT '是否启用构建通知', - build_failure_log_enabled BIT NOT NULL DEFAULT 0 COMMENT '构建失败时是否附加错误日志到通知(0:不附加,1:附加)', + notification_channel_id BIGINT NULL COMMENT '通知渠道ID(关联sys_notification_channel)', + deploy_notification_enabled BIT NOT NULL DEFAULT 1 COMMENT '是否启用部署通知', + deploy_notification_template_id BIGINT NULL COMMENT '部署通知模板ID(关联sys_notification_template)', + build_notification_enabled BIT NOT NULL DEFAULT 0 COMMENT '是否启用构建通知', + build_notification_template_id BIGINT NULL COMMENT '构建通知模板ID(关联sys_notification_template)', + build_failure_log_enabled BIT NOT NULL DEFAULT 0 COMMENT '构建失败时是否附加错误日志到通知(0:不附加,1:附加)', + build_failure_notification_template_id BIGINT NULL COMMENT '构建失败通知模板ID(关联sys_notification_template)', UNIQUE INDEX uk_team_env (team_id, environment_id), INDEX idx_team (team_id),