-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
501 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...nsion-common-flyway/src/main/resources/db/migration/V26__240124_ADD_alarm_rule_COLUMN.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
|
||
-- ---------------------------- | ||
-- Table structure for alarm_rule | ||
-- ---------------------------- | ||
ALTER TABLE `alarm_rule` | ||
ADD COLUMN `alert_notification_template_id` BIGINT(20) NULL DEFAULT NULL comment '告警模板ID' AFTER `env_type`; |
22 changes: 22 additions & 0 deletions
22
.../src/main/resources/db/migration/V27__240124_CREATE_alert_notification_template_TABLE.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
|
||
-- ---------------------------- | ||
-- Table structure for alert_notification_template | ||
-- ---------------------------- | ||
CREATE TABLE `alert_notification_template` ( | ||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT comment '主键', | ||
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment '创建时间', | ||
`gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '修改时间', | ||
`template_name` varchar(255) NULL comment '模板名称', | ||
`scene_type` varchar(255) NULL comment '场景类型:server、miniapp、iot', | ||
`be_default` tinyint(4) NULL comment '是否为默认模板', | ||
`channel_type` varchar(255) NULL comment '发送渠道:dingtalk、sms', | ||
`template_config` mediumtext NULL comment '模板配置', | ||
`tenant` varchar(255) NULL comment '租户', | ||
`workspace` varchar(255) NULL comment '工作空间', | ||
`creator` varchar(255) NULL comment '创建者', | ||
`modifier` varchar(255) NULL comment '修改者', | ||
PRIMARY KEY(`id`) | ||
) DEFAULT CHARSET = utf8mb4 COMMENT = '告警模板'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ain/java/io/holoinsight/server/home/dal/converter/AlertNotificationTemplateConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.dal.converter; | ||
|
||
import io.holoinsight.server.common.J; | ||
import io.holoinsight.server.common.dao.transformer.MapJsonMapper; | ||
import io.holoinsight.server.home.dal.model.AlertNotificationTemplate; | ||
import io.holoinsight.server.home.facade.AlertNotificationTemplateDTO; | ||
import io.holoinsight.server.home.facade.NotificationTemplate; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.mapstruct.Mapper; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-22 17:03:00 | ||
*/ | ||
@Mapper(componentModel = "spring", uses = {MapJsonMapper.class}) | ||
public interface AlertNotificationTemplateConverter { | ||
|
||
AlertNotificationTemplateDTO doToDTO(AlertNotificationTemplate template); | ||
|
||
AlertNotificationTemplate dtoToDO(AlertNotificationTemplateDTO templateDTO); | ||
|
||
List<AlertNotificationTemplateDTO> dosToDTOs(Iterable<AlertNotificationTemplate> templates); | ||
|
||
default String map(NotificationTemplate value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return J.toJson(value); | ||
} | ||
|
||
default NotificationTemplate map(String value) { | ||
if (StringUtils.isBlank(value)) { | ||
return null; | ||
} | ||
return J.fromJson(value, NotificationTemplate.class); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../src/main/java/io/holoinsight/server/home/dal/mapper/AlertNotificationTemplateMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.dal.mapper; | ||
|
||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import io.holoinsight.server.home.dal.model.AlertNotificationTemplate; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-22 16:56:00 | ||
*/ | ||
public interface AlertNotificationTemplateMapper extends BaseMapper<AlertNotificationTemplate> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ome-dal/src/main/java/io/holoinsight/server/home/dal/model/AlertNotificationTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.dal.model; | ||
|
||
import com.baomidou.mybatisplus.annotation.IdType; | ||
import com.baomidou.mybatisplus.annotation.TableId; | ||
import lombok.Data; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Table; | ||
import java.util.Date; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-22 16:48:00 | ||
*/ | ||
@Data | ||
@Table(name = "alert_notification_template") | ||
public class AlertNotificationTemplate { | ||
|
||
/** | ||
* id | ||
*/ | ||
@TableId(type = IdType.AUTO) | ||
public Long id; | ||
|
||
/** | ||
* 创建时间 | ||
*/ | ||
@Column(name = "gmt_create") | ||
public Date gmtCreate; | ||
|
||
/** | ||
* 修改时间 | ||
*/ | ||
@Column(name = "gmt_modified") | ||
public Date gmtModified; | ||
|
||
public String templateName; | ||
public String sceneType; | ||
public boolean beDefault; | ||
public String channelType; | ||
public String templateConfig; | ||
public String tenant; | ||
public String workspace; | ||
public String creator; | ||
public String modifier; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...-facade/src/main/java/io/holoinsight/server/home/facade/AlertNotificationTemplateDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. | ||
*/ | ||
package io.holoinsight.server.home.facade; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* @author masaimu | ||
* @version 2024-01-22 17:02:00 | ||
*/ | ||
@Data | ||
public class AlertNotificationTemplateDTO { | ||
/** | ||
* id | ||
*/ | ||
public Long id; | ||
|
||
/** | ||
* 创建时间 | ||
*/ | ||
public Date gmtCreate; | ||
|
||
/** | ||
* 修改时间 | ||
*/ | ||
public Date gmtModified; | ||
public String templateName; | ||
|
||
public String sceneType; | ||
public boolean beDefault; | ||
public String channelType; | ||
public NotificationTemplate templateConfig; | ||
public String tenant; | ||
public String workspace; | ||
public String creator; | ||
public String modifier; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.