This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 86420c018 [type:feat] alert template (#3404)
86420c018 is described below
commit 86420c0189dcad63ec9cb73b8ef5af4a14a23d6e
Author: Sinsy <[email protected]>
AuthorDate: Thu May 19 10:26:52 2022 +0800
[type:feat] alert template (#3404)
* alert template
* fix ci error & add sql
* fix ci error
* fix ci error
* change name
* fix ci error
* fix ci error
* fix ci error
* fix ci error
---
.../admin/controller/AlertTemplateController.java | 102 ++++++++++++++
.../shenyu/admin/mapper/AlertTemplateMapper.java | 66 +++++++++
.../shenyu/admin/model/dto/AlertTemplateDTO.java | 110 +++++++++++++++
.../shenyu/admin/model/entity/AlertTemplateDO.java | 153 +++++++++++++++++++++
.../shenyu/admin/model/vo/AlertTemplateVO.java | 111 +++++++++++++++
.../shenyu/admin/service/AlertTemplateService.java | 65 +++++++++
.../service/impl/AlertTemplateServiceImpl.java | 64 +++++++++
.../resources/mappers/alert-template-sqlmap.xml | 91 ++++++++++++
.../src/main/resources/sql-script/h2/schema.sql | 14 ++
.../src/main/resources/sql-script/mysql/schema.sql | 14 ++
10 files changed, 790 insertions(+)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AlertTemplateController.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AlertTemplateController.java
new file mode 100644
index 000000000..77b8ec200
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AlertTemplateController.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.controller;
+
+import org.apache.shenyu.admin.model.dto.AlertTemplateDTO;
+import org.apache.shenyu.admin.model.result.ShenyuAdminResult;
+import org.apache.shenyu.admin.model.vo.AlertTemplateVO;
+import org.apache.shenyu.admin.model.entity.AlertTemplateDO;
+import org.apache.shenyu.admin.service.AlertTemplateService;
+import org.apache.shenyu.admin.utils.ShenyuResultMessage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * AlertTemplate Controller.
+ */
+@Validated
+@RestController
+@RequestMapping("/alertTemplate")
+public class AlertTemplateController {
+
+ @Autowired
+ private AlertTemplateService alertTemplateService;
+
+ /**
+ * Add alert template.
+ * @param alertTemplateDTO alertTemplateDTO
+ * @return row int
+ */
+ @PostMapping("addTemplate")
+ public ShenyuAdminResult addTemplate(@Valid @RequestBody final
AlertTemplateDTO alertTemplateDTO) {
+ int row = alertTemplateService.addTemplate(alertTemplateDTO);
+ return ShenyuAdminResult.success(ShenyuResultMessage.CREATE_SUCCESS,
row);
+ }
+
+ /**
+ * Delete alert template.
+ * @param ids ids
+ * @return row int
+ */
+ @PostMapping("deleteTemplate")
+ public ShenyuAdminResult deleteTemplate(@RequestBody @NotEmpty final
List<@NotBlank String> ids) {
+ int row = alertTemplateService.deleteTemplate(ids);
+ return ShenyuAdminResult.success(ShenyuResultMessage.DELETE_SUCCESS,
row);
+ }
+
+ /**
+ * Update alert template.
+ * @param alertTemplateDTO alertTemplateDTO
+ * @return row int
+ */
+ @PostMapping("updateTemplate")
+ public ShenyuAdminResult updateTemplate(@Valid @RequestBody final
AlertTemplateDTO alertTemplateDTO) {
+ int row = alertTemplateService.updateTemplate(alertTemplateDTO);
+ return ShenyuAdminResult.success(ShenyuResultMessage.UPDATE_SUCCESS,
row);
+ }
+
+ /**
+ * Get all template.
+ * @return all {@link AlertTemplateVO}
+ */
+ @GetMapping("getAll")
+ public ShenyuAdminResult getAll() {
+ return ShenyuAdminResult.success(ShenyuResultMessage.QUERY_SUCCESS,
alertTemplateService.getAll());
+ }
+
+ /**
+ * Template detail.
+ * @param id id
+ * @return {@link AlertTemplateDO}
+ */
+ @GetMapping("detail/{id}")
+ public ShenyuAdminResult detail(@PathVariable("id") final Long id) {
+ return ShenyuAdminResult.success(ShenyuResultMessage.DETAIL_SUCCESS,
alertTemplateService.detail(id));
+ }
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AlertTemplateMapper.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AlertTemplateMapper.java
new file mode 100644
index 000000000..70dc5220f
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/mapper/AlertTemplateMapper.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.shenyu.admin.model.dto.AlertTemplateDTO;
+import org.apache.shenyu.admin.model.entity.AlertTemplateDO;
+import org.apache.shenyu.admin.model.vo.AlertTemplateVO;
+
+import java.util.List;
+
+/**
+ * AlertTemplateMapper.
+ */
+@Mapper
+public interface AlertTemplateMapper {
+
+ /**
+ * delete by ids.
+ * @param ids ids
+ * @return rows int
+ */
+ int deleteByIds(List<String> ids);
+
+ /**
+ * insert selective alertTemplateDTO.
+ * @param alertTemplateDTO {@linkplain AlertTemplateDTO}
+ * @return rows int
+ */
+ int insertSelective(AlertTemplateDTO alertTemplateDTO);
+
+ /**
+ * select by id.
+ * @param id id
+ * @return {@linkplain AlertTemplateDO}
+ */
+ AlertTemplateDO selectByPrimaryKey(Long id);
+
+ /**
+ * update selective alertTemplate by id.
+ * @param alertTemplateDTO {@linkplain AlertTemplateDTO}
+ * @return rows int
+ */
+ int updateByPrimaryKeySelective(AlertTemplateDTO alertTemplateDTO);
+
+ /**
+ * select all.
+ * @return list of AlertTemplateVO
+ */
+ List<AlertTemplateVO> selectAll();
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/AlertTemplateDTO.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/AlertTemplateDTO.java
new file mode 100644
index 000000000..75e9e6f13
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/AlertTemplateDTO.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.dto;
+
+import javax.validation.constraints.NotNull;
+
+public class AlertTemplateDTO {
+
+ /**
+ * alert template id.
+ */
+ private Long id;
+
+ /**
+ * alert template name.
+ */
+ @NotNull
+ private String name;
+
+ /**
+ * alert template strategyName.
+ */
+ @NotNull
+ private String strategyName;
+
+ /**
+ * alert template content.
+ */
+ @NotNull
+ private String content;
+
+ /**
+ * get id.
+ * @return id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * set id.
+ * @param id id
+ */
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ /**
+ * get alert template name.
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * set alert template name.
+ * @param name name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * get alert template strategy name.
+ * @return strategyName
+ */
+ public String getStrategyName() {
+ return strategyName;
+ }
+
+ /**
+ * set alert template strategy name.
+ * @param strategyName strategyName
+ */
+ public void setStrategyName(final String strategyName) {
+ this.strategyName = strategyName;
+ }
+
+ /**
+ * get content.
+ * @return content
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * set content.
+ * @param content content
+ */
+ public void setContent(final String content) {
+ this.content = content;
+ }
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/AlertTemplateDO.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/AlertTemplateDO.java
new file mode 100644
index 000000000..1934a94c8
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/AlertTemplateDO.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.entity;
+
+import java.util.Date;
+
+/**
+ * AlertTemplate.
+ */
+public class AlertTemplateDO {
+
+ /**
+ * primary key id.
+ */
+ private Long id;
+
+ /**
+ * alert template name.
+ */
+ private String name;
+
+ /**
+ * alert template strategy name.
+ */
+ private String strategyName;
+
+ /**
+ * alert template content.
+ */
+ private String content;
+
+ /**
+ * create time.
+ */
+ private Date dateCreated;
+
+ /**
+ * update time.
+ */
+ private Date dateUpdated;
+
+ /**
+ * get id.
+ * @return id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * set id.
+ * @param id id
+ */
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ /**
+ * get name.
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * set name.
+ * @param name name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * get strategyName.
+ * @return strategyName
+ */
+ public String getStrategyName() {
+ return strategyName;
+ }
+
+ /**
+ * set strategyName.
+ * @param strategyName strategyName
+ */
+ public void setStrategyName(final String strategyName) {
+ this.strategyName = strategyName;
+ }
+
+ /**
+ * get content.
+ * @return content
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * set content.
+ * @param content content
+ */
+ public void setContent(final String content) {
+ this.content = content;
+ }
+
+ /**
+ * get dateCreated.
+ * @return dateCreated
+ */
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+ /**
+ * set dateCreated.
+ * @param dateCreated dateCreated
+ */
+ public void setDateCreated(final Date dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+ /**
+ * get dateUpdated.
+ * @return dateUpdated
+ */
+ public Date getDateUpdated() {
+ return dateUpdated;
+ }
+
+ /**
+ * set dateUpdated.
+ * @param dateUpdated dateUpdated
+ */
+ public void setDateUpdated(final Date dateUpdated) {
+ this.dateUpdated = dateUpdated;
+ }
+
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/AlertTemplateVO.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/AlertTemplateVO.java
new file mode 100644
index 000000000..4a54f6ac6
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/AlertTemplateVO.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.model.vo;
+
+public class AlertTemplateVO {
+
+ private Long id;
+
+ private String name;
+
+ private String strategyName;
+
+ private String dateCreated;
+
+ private String dateUpdated;
+
+ /**
+ * get id.
+ * @return id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * set id.
+ * @param id id
+ */
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ /**
+ * get alert template name.
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * set name.
+ * @param name alert template name.
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * get alert template strategy name.
+ * @return strategyName
+ */
+ public String getStrategyName() {
+ return strategyName;
+ }
+
+ /**
+ * set alert template strategy name.
+ * @param strategyName strategyName
+ */
+ public void setStrategyName(final String strategyName) {
+ this.strategyName = strategyName;
+ }
+
+ /**
+ * get create time.
+ * @return dateCreated
+ */
+ public String getDateCreated() {
+ return dateCreated;
+ }
+
+ /**
+ * set create time.
+ * @param dateCreated dateCreated
+ */
+ public void setDateCreated(final String dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+ /**
+ * get update time.
+ * @return dateUpdated
+ */
+ public String getDateUpdated() {
+ return dateUpdated;
+ }
+
+ /**
+ * set update time.
+ * @param dateUpdated dateUpdated
+ */
+ public void setDateUpdated(final String dateUpdated) {
+ this.dateUpdated = dateUpdated;
+ }
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AlertTemplateService.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AlertTemplateService.java
new file mode 100644
index 000000000..d50abd28d
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/AlertTemplateService.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.service;
+
+import org.apache.shenyu.admin.model.dto.AlertTemplateDTO;
+import org.apache.shenyu.admin.model.entity.AlertTemplateDO;
+import org.apache.shenyu.admin.model.vo.AlertTemplateVO;
+
+import java.util.List;
+
+/**
+ * Alert template service.
+ */
+public interface AlertTemplateService {
+
+ /**
+ * Add alert template.
+ * @param alertTemplateDTO alertTemplateDTO
+ * @return row int
+ */
+ int addTemplate(AlertTemplateDTO alertTemplateDTO);
+
+ /**
+ * Delete alert template.
+ * @param ids ids
+ * @return row int
+ */
+ int deleteTemplate(List<String> ids);
+
+ /**
+ * Update alert template.
+ * @param alertTemplateDTO alertTemplateDTO
+ * @return row int
+ */
+ int updateTemplate(AlertTemplateDTO alertTemplateDTO);
+
+ /**
+ * Get all template.
+ * @return all {@link AlertTemplateVO}
+ */
+ List<AlertTemplateVO> getAll();
+
+ /**
+ * Template detail.
+ * @param id id
+ * @return {@link AlertTemplateDO}
+ */
+ AlertTemplateDO detail(Long id);
+
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AlertTemplateServiceImpl.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AlertTemplateServiceImpl.java
new file mode 100644
index 000000000..ecd39c879
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AlertTemplateServiceImpl.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.service.impl;
+
+import org.apache.shenyu.admin.mapper.AlertTemplateMapper;
+import org.apache.shenyu.admin.model.dto.AlertTemplateDTO;
+import org.apache.shenyu.admin.model.entity.AlertTemplateDO;
+import org.apache.shenyu.admin.model.vo.AlertTemplateVO;
+import org.apache.shenyu.admin.service.AlertTemplateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Implementation of the {@link AlertTemplateService}.
+ */
+@Service
+public class AlertTemplateServiceImpl implements AlertTemplateService {
+
+ @Autowired
+ private AlertTemplateMapper alertTemplateMapper;
+
+ @Override
+ public int addTemplate(final AlertTemplateDTO alertTemplateDTO) {
+
+ return alertTemplateMapper.insertSelective(alertTemplateDTO);
+ }
+
+ @Override
+ public int deleteTemplate(final List<String> ids) {
+ return alertTemplateMapper.deleteByIds(ids);
+ }
+
+ @Override
+ public int updateTemplate(final AlertTemplateDTO alertTemplateDTO) {
+ return
alertTemplateMapper.updateByPrimaryKeySelective(alertTemplateDTO);
+ }
+
+ @Override
+ public List<AlertTemplateVO> getAll() {
+ return alertTemplateMapper.selectAll();
+ }
+
+ @Override
+ public AlertTemplateDO detail(final Long id) {
+ return alertTemplateMapper.selectByPrimaryKey(id);
+ }
+}
diff --git a/shenyu-admin/src/main/resources/mappers/alert-template-sqlmap.xml
b/shenyu-admin/src/main/resources/mappers/alert-template-sqlmap.xml
new file mode 100644
index 000000000..d3857d0f3
--- /dev/null
+++ b/shenyu-admin/src/main/resources/mappers/alert-template-sqlmap.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.shenyu.admin.mapper.AlertTemplateMapper">
+ <resultMap id="BaseResultMap"
type="org.apache.shenyu.admin.model.entity.AlertTemplateDO">
+ <[email protected]>
+ <!--@Table alert_template-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="name" jdbcType="VARCHAR" property="name" />
+ <result column="strategy_name" jdbcType="VARCHAR" property="strategyName"
/>
+ <result column="content" jdbcType="VARCHAR" property="content" />
+ <result column="date_created" jdbcType="TIMESTAMP" property="dateCreated"
/>
+ <result column="date_updated" jdbcType="TIMESTAMP" property="dateUpdated"
/>
+ </resultMap>
+ <sql id="Base_Column_List">
+ id, `name`, strategy_name, content, date_created, date_updated
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long"
resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List" />
+ from alert_template
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <delete id="deleteByIds" parameterType="java.lang.Long">
+ delete from alert_template
+ where id in
+ <foreach item="id" collection="list" open="(" separator="," close=")">
+ #{id, jdbcType=VARCHAR}
+ </foreach>
+ </delete>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="org.apache.shenyu.admin.model.dto.AlertTemplateDTO"
useGeneratedKeys="true">
+ insert into alert_template
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="name != null">
+ `name`,
+ </if>
+ <if test="strategyName != null">
+ strategy_name,
+ </if>
+ <if test="content != null">
+ content,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="name != null">
+ #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="strategyName != null">
+ #{strategyName,jdbcType=VARCHAR},
+ </if>
+ <if test="content != null">
+ #{content,jdbcType=VARCHAR},
+ </if>
+ </trim>
+ </insert>
+ <update id="updateByPrimaryKeySelective"
parameterType="org.apache.shenyu.admin.model.dto.AlertTemplateDTO">
+ update alert_template
+ <set>
+ <if test="name != null">
+ `name` = #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="strategyName != null">
+ strategy_name = #{strategyName,jdbcType=VARCHAR},
+ </if>
+ <if test="content != null">
+ content = #{content,jdbcType=VARCHAR},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+ <select id="selectAll"
resultType="org.apache.shenyu.admin.model.vo.AlertTemplateVO">
+ select <include refid="Base_Column_List"/> from alert_template
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
index 51794b245..1031393de 100644
--- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
@@ -255,6 +255,20 @@ CREATE TABLE IF NOT EXISTS `operation_record_log`
`operation_type` varchar(60) NOT NULL DEFAULT 'update' COMMENT 'operation
type:create/update/delete/register...'
);
+-- ----------------------------
+-- Table structure for alert_template
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `alert_template`
+(
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'primary
key id',
+ `name` varchar(255) NOT NULL COMMENT 'alert template name',
+ `strategy_name` varchar(255) NOT NULL COMMENT 'alert template strategy
name',
+ `content` varchar(1000) NOT NULL COMMENT 'alert template content',
+ `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'create time',
+ `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
+ PRIMARY KEY (`id`) USING BTREE
+);
+
/**default admin user**/
INSERT IGNORE INTO `dashboard_user` (`id`, `user_name`, `password`, `role`,
`enabled`) VALUES
('1','admin','ba3253876aed6bc22d4a6ff53d8406c6ad864195ed144ab5c87621b6c233b548baeae6956df346ec8c17f5ea10f35ee3cbc514797ed7ddd3145464e2a0bab413',
'1', '1');
diff --git a/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
b/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
index 13687aa68..9df2180e2 100644
--- a/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/mysql/schema.sql
@@ -261,6 +261,20 @@ CREATE TABLE IF NOT EXISTS `operation_record_log`
`operation_type` varchar(60) default 'update' not null comment 'operation
type:create/update/delete/register...'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
ROW_FORMAT=DYNAMIC comment 'operation record log';
+-- ----------------------------
+-- Table structure for alert_template
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `alert_template`
+(
+ `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key id',
+ `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT
NULL COMMENT 'alert template name',
+ `strategy_name` varchar(255) CHARACTER SET utf8mb4 COLLATE
utf8mb4_unicode_ci NOT NULL COMMENT 'alert template strategy name',
+ `content` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
NOT NULL COMMENT 'alert template content',
+ `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'create time',
+ `date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP COMMENT 'update time',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE =
utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
+
/**default admin user**/
INSERT IGNORE INTO `dashboard_user` (`id`, `user_name`, `password`, `role`,
`enabled`) VALUES
('1','admin','ba3253876aed6bc22d4a6ff53d8406c6ad864195ed144ab5c87621b6c233b548baeae6956df346ec8c17f5ea10f35ee3cbc514797ed7ddd3145464e2a0bab413',
'1', '1');