From cc922865ea471318e3bf8168f3fa45d43fc62adf Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 5 Mar 2020 14:55:02 +0800 Subject: [PATCH] flyway --- backend/pom.xml | 8 +- .../base/domain/LoadTestReport.java | 30 ++- .../base/domain/LoadTestReportExample.java | 140 +++++++------- .../base/mapper/LoadTestReportMapper.java | 9 +- .../base/mapper/LoadTestReportMapper.xml | 107 +++++++--- .../src/main/resources/application.properties | 9 + .../main/resources/db/migration/V1__init.sql | 1 + .../db/migration/V2__metersphere_ddl.sql | 183 ++++++++++++++++++ .../resources/db/migration/V3__init_data.sql | 11 ++ 9 files changed, 392 insertions(+), 106 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V1__init.sql create mode 100644 backend/src/main/resources/db/migration/V2__metersphere_ddl.sql create mode 100644 backend/src/main/resources/db/migration/V3__init_data.sql diff --git a/backend/pom.xml b/backend/pom.xml index 7500d12a39..72bfcaa3a3 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -64,7 +64,11 @@ org.springframework.boot spring-boot-starter-websocket - + + + org.flywaydb + flyway-core + mysql mysql-connector-java @@ -75,7 +79,7 @@ pagehelper 5.0.3 - + org.apache.shiro shiro-spring-boot-starter diff --git a/backend/src/main/java/io/metersphere/base/domain/LoadTestReport.java b/backend/src/main/java/io/metersphere/base/domain/LoadTestReport.java index 019017c1e2..a951758094 100644 --- a/backend/src/main/java/io/metersphere/base/domain/LoadTestReport.java +++ b/backend/src/main/java/io/metersphere/base/domain/LoadTestReport.java @@ -11,12 +11,14 @@ public class LoadTestReport implements Serializable { private String description; - private String status; - private Long createTime; private Long updateTime; + private String status; + + private String content; + private static final long serialVersionUID = 1L; public String getId() { @@ -51,14 +53,6 @@ public class LoadTestReport implements Serializable { this.description = description == null ? null : description.trim(); } - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status == null ? null : status.trim(); - } - public Long getCreateTime() { return createTime; } @@ -74,4 +68,20 @@ public class LoadTestReport implements Serializable { public void setUpdateTime(Long updateTime) { this.updateTime = updateTime; } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status == null ? null : status.trim(); + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/LoadTestReportExample.java b/backend/src/main/java/io/metersphere/base/domain/LoadTestReportExample.java index d8094d52c5..da9296c6ca 100644 --- a/backend/src/main/java/io/metersphere/base/domain/LoadTestReportExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/LoadTestReportExample.java @@ -384,76 +384,6 @@ public class LoadTestReportExample { return (Criteria) this; } - public Criteria andStatusIsNull() { - addCriterion("status is null"); - return (Criteria) this; - } - - public Criteria andStatusIsNotNull() { - addCriterion("status is not null"); - return (Criteria) this; - } - - public Criteria andStatusEqualTo(String value) { - addCriterion("status =", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotEqualTo(String value) { - addCriterion("status <>", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThan(String value) { - addCriterion("status >", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThanOrEqualTo(String value) { - addCriterion("status >=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThan(String value) { - addCriterion("status <", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThanOrEqualTo(String value) { - addCriterion("status <=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLike(String value) { - addCriterion("status like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotLike(String value) { - addCriterion("status not like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusIn(List values) { - addCriterion("status in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotIn(List values) { - addCriterion("status not in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusBetween(String value1, String value2) { - addCriterion("status between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotBetween(String value1, String value2) { - addCriterion("status not between", value1, value2, "status"); - return (Criteria) this; - } - public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; @@ -573,6 +503,76 @@ public class LoadTestReportExample { addCriterion("update_time not between", value1, value2, "updateTime"); return (Criteria) this; } + + public Criteria andStatusIsNull() { + addCriterion("status is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("status is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(String value) { + addCriterion("status =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(String value) { + addCriterion("status <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(String value) { + addCriterion("status >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(String value) { + addCriterion("status >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(String value) { + addCriterion("status <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(String value) { + addCriterion("status <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLike(String value) { + addCriterion("status like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotLike(String value) { + addCriterion("status not like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("status in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("status not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(String value1, String value2) { + addCriterion("status between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(String value1, String value2) { + addCriterion("status not between", value1, value2, "status"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.java b/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.java index 0c58b41594..8bddc4ec16 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.java @@ -2,9 +2,10 @@ package io.metersphere.base.mapper; import io.metersphere.base.domain.LoadTestReport; import io.metersphere.base.domain.LoadTestReportExample; -import java.util.List; import org.apache.ibatis.annotations.Param; +import java.util.List; + public interface LoadTestReportMapper { long countByExample(LoadTestReportExample example); @@ -16,15 +17,21 @@ public interface LoadTestReportMapper { int insertSelective(LoadTestReport record); + List selectByExampleWithBLOBs(LoadTestReportExample example); + List selectByExample(LoadTestReportExample example); LoadTestReport selectByPrimaryKey(String id); int updateByExampleSelective(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example); + int updateByExampleWithBLOBs(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example); + int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example); int updateByPrimaryKeySelective(LoadTestReport record); + int updateByPrimaryKeyWithBLOBs(LoadTestReport record); + int updateByPrimaryKey(LoadTestReport record); } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.xml index ea252e4060..f3a8eb852d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.xml @@ -6,9 +6,12 @@ - + + + + @@ -69,8 +72,27 @@ - id, test_id, name, description, status, create_time, update_time + id, test_id, name, description, create_time, update_time, status + + content + + - select + , + from load_test_report where id = #{id,jdbcType=VARCHAR} @@ -103,11 +127,11 @@ insert into load_test_report (id, test_id, name, - description, status, create_time, - update_time) + description, create_time, update_time, + status, content) values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, - #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, - #{updateTime,jdbcType=BIGINT}) + #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{status,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}) insert into load_test_report @@ -124,15 +148,18 @@ description, - - status, - create_time, update_time, + + status, + + + content, + @@ -147,15 +174,18 @@ #{description,jdbcType=VARCHAR}, - - #{status,jdbcType=VARCHAR}, - #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + + #{status,jdbcType=VARCHAR}, + + + #{content,jdbcType=LONGVARCHAR}, +