From e7bbfe074d1fd6621e6ec870a680954da9d28f4c Mon Sep 17 00:00:00 2001 From: haifeng414 Date: Mon, 17 Feb 2020 17:32:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=96=87=E4=BB=B6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E5=88=86=E6=88=90?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/base/domain/FileContent.java | 27 ++ .../base/domain/FileContentExample.java | 270 ++++++++++++++++++ .../{FileStore.java => FileMetadata.java} | 22 +- ...eExample.java => FileMetadataExample.java} | 74 +---- ...leStoreResource.java => LoadTestFile.java} | 12 +- ...eExample.java => LoadTestFileExample.java} | 74 +---- .../base/mapper/FileContentMapper.java | 34 +++ .../base/mapper/FileContentMapper.xml | 194 +++++++++++++ .../base/mapper/FileMetadataMapper.java | 30 ++ ...StoreMapper.xml => FileMetadataMapper.xml} | 130 ++------- .../base/mapper/FileStoreMapper.java | 36 --- .../base/mapper/FileStoreResourceMapper.java | 22 -- .../base/mapper/LoadTestFileMapper.java | 22 ++ ...ourceMapper.xml => LoadTestFileMapper.xml} | 47 ++- .../metersphere/service/LoadTestService.java | 49 ++-- .../src/main/resources/generatorConfig.xml | 5 +- 16 files changed, 656 insertions(+), 392 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/base/domain/FileContent.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/FileContentExample.java rename backend/src/main/java/io/metersphere/base/domain/{FileStore.java => FileMetadata.java} (71%) rename backend/src/main/java/io/metersphere/base/domain/{FileStoreExample.java => FileMetadataExample.java} (87%) rename backend/src/main/java/io/metersphere/base/domain/{FileStoreResource.java => LoadTestFile.java} (65%) rename backend/src/main/java/io/metersphere/base/domain/{FileStoreResourceExample.java => LoadTestFileExample.java} (79%) create mode 100644 backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml create mode 100644 backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.java rename backend/src/main/java/io/metersphere/base/mapper/{FileStoreMapper.xml => FileMetadataMapper.xml} (66%) delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.java delete mode 100644 backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.java rename backend/src/main/java/io/metersphere/base/mapper/{FileStoreResourceMapper.xml => LoadTestFileMapper.xml} (80%) diff --git a/backend/src/main/java/io/metersphere/base/domain/FileContent.java b/backend/src/main/java/io/metersphere/base/domain/FileContent.java new file mode 100644 index 0000000000..91f16f6d2e --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/FileContent.java @@ -0,0 +1,27 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; + +public class FileContent implements Serializable { + private String id; + + private String file; + + private static final long serialVersionUID = 1L; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id == null ? null : id.trim(); + } + + public String getFile() { + return file; + } + + public void setFile(String file) { + this.file = file == null ? null : file.trim(); + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/FileContentExample.java b/backend/src/main/java/io/metersphere/base/domain/FileContentExample.java new file mode 100644 index 0000000000..98a732bec8 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/FileContentExample.java @@ -0,0 +1,270 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class FileContentExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public FileContentExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/FileStore.java b/backend/src/main/java/io/metersphere/base/domain/FileMetadata.java similarity index 71% rename from backend/src/main/java/io/metersphere/base/domain/FileStore.java rename to backend/src/main/java/io/metersphere/base/domain/FileMetadata.java index 484db7358d..047b2db62a 100644 --- a/backend/src/main/java/io/metersphere/base/domain/FileStore.java +++ b/backend/src/main/java/io/metersphere/base/domain/FileMetadata.java @@ -2,13 +2,11 @@ package io.metersphere.base.domain; import java.io.Serializable; -public class FileStore implements Serializable { +public class FileMetadata implements Serializable { private String id; private String name; - private String description; - private String type; private Long size; @@ -17,8 +15,6 @@ public class FileStore implements Serializable { private Long updateTime; - private String file; - private static final long serialVersionUID = 1L; public String getId() { @@ -37,14 +33,6 @@ public class FileStore implements Serializable { this.name = name == null ? null : name.trim(); } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description == null ? null : description.trim(); - } - public String getType() { return type; } @@ -76,12 +64,4 @@ public class FileStore implements Serializable { public void setUpdateTime(Long updateTime) { this.updateTime = updateTime; } - - public String getFile() { - return file; - } - - public void setFile(String file) { - this.file = file == null ? null : file.trim(); - } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/FileStoreExample.java b/backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java similarity index 87% rename from backend/src/main/java/io/metersphere/base/domain/FileStoreExample.java rename to backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java index d2f77fc261..653beb3de9 100644 --- a/backend/src/main/java/io/metersphere/base/domain/FileStoreExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java @@ -3,14 +3,14 @@ package io.metersphere.base.domain; import java.util.ArrayList; import java.util.List; -public class FileStoreExample { +public class FileMetadataExample { protected String orderByClause; protected boolean distinct; protected List oredCriteria; - public FileStoreExample() { + public FileMetadataExample() { oredCriteria = new ArrayList(); } @@ -244,76 +244,6 @@ public class FileStoreExample { return (Criteria) this; } - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - public Criteria andTypeIsNull() { addCriterion("type is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/domain/FileStoreResource.java b/backend/src/main/java/io/metersphere/base/domain/LoadTestFile.java similarity index 65% rename from backend/src/main/java/io/metersphere/base/domain/FileStoreResource.java rename to backend/src/main/java/io/metersphere/base/domain/LoadTestFile.java index 042e7952c7..cc243ec086 100644 --- a/backend/src/main/java/io/metersphere/base/domain/FileStoreResource.java +++ b/backend/src/main/java/io/metersphere/base/domain/LoadTestFile.java @@ -2,13 +2,11 @@ package io.metersphere.base.domain; import java.io.Serializable; -public class FileStoreResource implements Serializable { +public class LoadTestFile implements Serializable { private String testId; private String fileId; - private String fileType; - private static final long serialVersionUID = 1L; public String getTestId() { @@ -26,12 +24,4 @@ public class FileStoreResource implements Serializable { public void setFileId(String fileId) { this.fileId = fileId == null ? null : fileId.trim(); } - - public String getFileType() { - return fileType; - } - - public void setFileType(String fileType) { - this.fileType = fileType == null ? null : fileType.trim(); - } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/FileStoreResourceExample.java b/backend/src/main/java/io/metersphere/base/domain/LoadTestFileExample.java similarity index 79% rename from backend/src/main/java/io/metersphere/base/domain/FileStoreResourceExample.java rename to backend/src/main/java/io/metersphere/base/domain/LoadTestFileExample.java index 329415dbb3..1386bb4661 100644 --- a/backend/src/main/java/io/metersphere/base/domain/FileStoreResourceExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/LoadTestFileExample.java @@ -3,14 +3,14 @@ package io.metersphere.base.domain; import java.util.ArrayList; import java.util.List; -public class FileStoreResourceExample { +public class LoadTestFileExample { protected String orderByClause; protected boolean distinct; protected List oredCriteria; - public FileStoreResourceExample() { + public LoadTestFileExample() { oredCriteria = new ArrayList(); } @@ -243,76 +243,6 @@ public class FileStoreResourceExample { addCriterion("file_id not between", value1, value2, "fileId"); return (Criteria) this; } - - public Criteria andFileTypeIsNull() { - addCriterion("file_type is null"); - return (Criteria) this; - } - - public Criteria andFileTypeIsNotNull() { - addCriterion("file_type is not null"); - return (Criteria) this; - } - - public Criteria andFileTypeEqualTo(String value) { - addCriterion("file_type =", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeNotEqualTo(String value) { - addCriterion("file_type <>", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeGreaterThan(String value) { - addCriterion("file_type >", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeGreaterThanOrEqualTo(String value) { - addCriterion("file_type >=", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeLessThan(String value) { - addCriterion("file_type <", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeLessThanOrEqualTo(String value) { - addCriterion("file_type <=", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeLike(String value) { - addCriterion("file_type like", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeNotLike(String value) { - addCriterion("file_type not like", value, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeIn(List values) { - addCriterion("file_type in", values, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeNotIn(List values) { - addCriterion("file_type not in", values, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeBetween(String value1, String value2) { - addCriterion("file_type between", value1, value2, "fileType"); - return (Criteria) this; - } - - public Criteria andFileTypeNotBetween(String value1, String value2) { - addCriterion("file_type not between", value1, value2, "fileType"); - return (Criteria) this; - } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.java b/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.java new file mode 100644 index 0000000000..c0477914f5 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.java @@ -0,0 +1,34 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.FileContent; +import io.metersphere.base.domain.FileContentExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface FileContentMapper { + long countByExample(FileContentExample example); + + int deleteByExample(FileContentExample example); + + int deleteByPrimaryKey(String id); + + int insert(FileContent record); + + int insertSelective(FileContent record); + + List selectByExampleWithBLOBs(FileContentExample example); + + List selectByExample(FileContentExample example); + + FileContent selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") FileContent record, @Param("example") FileContentExample example); + + int updateByExampleWithBLOBs(@Param("record") FileContent record, @Param("example") FileContentExample example); + + int updateByExample(@Param("record") FileContent record, @Param("example") FileContentExample example); + + int updateByPrimaryKeySelective(FileContent record); + + int updateByPrimaryKeyWithBLOBs(FileContent record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml new file mode 100644 index 0000000000..9d7344b93a --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/FileContentMapper.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id + + + file + + + + + + delete from file_content + where id = #{id,jdbcType=VARCHAR} + + + delete from file_content + + + + + + insert into file_content (id, file) + values (#{id,jdbcType=VARCHAR}, #{file,jdbcType=LONGVARCHAR}) + + + insert into file_content + + + id, + + + file, + + + + + #{id,jdbcType=VARCHAR}, + + + #{file,jdbcType=LONGVARCHAR}, + + + + + + update file_content + + + id = #{record.id,jdbcType=VARCHAR}, + + + file = #{record.file,jdbcType=LONGVARCHAR}, + + + + + + + + update file_content + set id = #{record.id,jdbcType=VARCHAR}, + file = #{record.file,jdbcType=LONGVARCHAR} + + + + + + update file_content + set id = #{record.id,jdbcType=VARCHAR} + + + + + + update file_content + + + file = #{file,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update file_content + set file = #{file,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.java b/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.java new file mode 100644 index 0000000000..24af6fcf49 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.java @@ -0,0 +1,30 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.FileMetadata; +import io.metersphere.base.domain.FileMetadataExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface FileMetadataMapper { + long countByExample(FileMetadataExample example); + + int deleteByExample(FileMetadataExample example); + + int deleteByPrimaryKey(String id); + + int insert(FileMetadata record); + + int insertSelective(FileMetadata record); + + List selectByExample(FileMetadataExample example); + + FileMetadata selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") FileMetadata record, @Param("example") FileMetadataExample example); + + int updateByExample(@Param("record") FileMetadata record, @Param("example") FileMetadataExample example); + + int updateByPrimaryKeySelective(FileMetadata record); + + int updateByPrimaryKey(FileMetadata record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml similarity index 66% rename from backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.xml rename to backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml index 7b6692154d..b10df4fe3b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml @@ -1,18 +1,14 @@ - - + + - - - - @@ -72,20 +68,15 @@ - id, name, description, type, size, create_time, update_time + id, name, type, size, create_time, update_time - - file - - select distinct - , - - from file_store + from file_metadata @@ -93,48 +84,32 @@ order by ${orderByClause} - - select - , - - from file_store + from file_metadata where id = #{id,jdbcType=VARCHAR} - delete from file_store + delete from file_metadata where id = #{id,jdbcType=VARCHAR} - - delete from file_store + + delete from file_metadata - - insert into file_store (id, name, description, - type, size, create_time, - update_time, file) - values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{size,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, - #{updateTime,jdbcType=BIGINT}, #{file,jdbcType=LONGVARCHAR}) + + insert into file_metadata (id, name, type, + size, create_time, update_time + ) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, + #{size,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT} + ) - - insert into file_store + + insert into file_metadata id, @@ -142,9 +117,6 @@ name, - - description, - type, @@ -157,9 +129,6 @@ update_time, - - file, - @@ -168,9 +137,6 @@ #{name,jdbcType=VARCHAR}, - - #{description,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, @@ -183,19 +149,16 @@ #{updateTime,jdbcType=BIGINT}, - - #{file,jdbcType=LONGVARCHAR}, - - + select count(*) from file_metadata - update file_store + update file_metadata id = #{record.id,jdbcType=VARCHAR}, @@ -203,9 +166,6 @@ name = #{record.name,jdbcType=VARCHAR}, - - description = #{record.description,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, @@ -218,33 +178,15 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, - - file = #{record.file,jdbcType=LONGVARCHAR}, - - - update file_store - set id = #{record.id,jdbcType=VARCHAR}, - name = #{record.name,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, - size = #{record.size,jdbcType=BIGINT}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - file = #{record.file,jdbcType=LONGVARCHAR} - - - - - update file_store + update file_metadata set id = #{record.id,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, type = #{record.type,jdbcType=VARCHAR}, size = #{record.size,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT}, @@ -253,15 +195,12 @@ - - update file_store + + update file_metadata name = #{name,jdbcType=VARCHAR}, - - description = #{description,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, @@ -274,27 +213,12 @@ update_time = #{updateTime,jdbcType=BIGINT}, - - file = #{file,jdbcType=LONGVARCHAR}, - where id = #{id,jdbcType=VARCHAR} - - update file_store + + update file_metadata set name = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - size = #{size,jdbcType=BIGINT}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - file = #{file,jdbcType=LONGVARCHAR} - where id = #{id,jdbcType=VARCHAR} - - - update file_store - set name = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, type = #{type,jdbcType=VARCHAR}, size = #{size,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT}, diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.java b/backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.java deleted file mode 100644 index 9ef1b79255..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/FileStoreMapper.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.metersphere.base.mapper; - -import io.metersphere.base.domain.FileStore; -import io.metersphere.base.domain.FileStoreExample; -import java.util.List; -import org.apache.ibatis.annotations.Param; - -public interface FileStoreMapper { - long countByExample(FileStoreExample example); - - int deleteByExample(FileStoreExample example); - - int deleteByPrimaryKey(String id); - - int insert(FileStore record); - - int insertSelective(FileStore record); - - List selectByExampleWithBLOBs(FileStoreExample example); - - List selectByExample(FileStoreExample example); - - FileStore selectByPrimaryKey(String id); - - int updateByExampleSelective(@Param("record") FileStore record, @Param("example") FileStoreExample example); - - int updateByExampleWithBLOBs(@Param("record") FileStore record, @Param("example") FileStoreExample example); - - int updateByExample(@Param("record") FileStore record, @Param("example") FileStoreExample example); - - int updateByPrimaryKeySelective(FileStore record); - - int updateByPrimaryKeyWithBLOBs(FileStore record); - - int updateByPrimaryKey(FileStore record); -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.java b/backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.java deleted file mode 100644 index dce429b1cf..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.metersphere.base.mapper; - -import io.metersphere.base.domain.FileStoreResource; -import io.metersphere.base.domain.FileStoreResourceExample; -import java.util.List; -import org.apache.ibatis.annotations.Param; - -public interface FileStoreResourceMapper { - long countByExample(FileStoreResourceExample example); - - int deleteByExample(FileStoreResourceExample example); - - int insert(FileStoreResource record); - - int insertSelective(FileStoreResource record); - - List selectByExample(FileStoreResourceExample example); - - int updateByExampleSelective(@Param("record") FileStoreResource record, @Param("example") FileStoreResourceExample example); - - int updateByExample(@Param("record") FileStoreResource record, @Param("example") FileStoreResourceExample example); -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.java b/backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.java new file mode 100644 index 0000000000..82ca9a97fc --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.java @@ -0,0 +1,22 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.LoadTestFile; +import io.metersphere.base.domain.LoadTestFileExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface LoadTestFileMapper { + long countByExample(LoadTestFileExample example); + + int deleteByExample(LoadTestFileExample example); + + int insert(LoadTestFile record); + + int insertSelective(LoadTestFile record); + + List selectByExample(LoadTestFileExample example); + + int updateByExampleSelective(@Param("record") LoadTestFile record, @Param("example") LoadTestFileExample example); + + int updateByExample(@Param("record") LoadTestFile record, @Param("example") LoadTestFileExample example); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.xml similarity index 80% rename from backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.xml rename to backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.xml index ae1f7646e0..cd2defde05 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/FileStoreResourceMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/LoadTestFileMapper.xml @@ -1,10 +1,9 @@ - - + + - @@ -65,15 +64,15 @@ - test_id, file_id, file_type + test_id, file_id - select distinct - from file_store_resource + from load_test_file @@ -81,20 +80,18 @@ order by ${orderByClause} - - delete from file_store_resource + + delete from load_test_file - - insert into file_store_resource (test_id, file_id, file_type - ) - values (#{testId,jdbcType=VARCHAR}, #{fileId,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR} - ) + + insert into load_test_file (test_id, file_id) + values (#{testId,jdbcType=VARCHAR}, #{fileId,jdbcType=VARCHAR}) - - insert into file_store_resource + + insert into load_test_file test_id, @@ -102,9 +99,6 @@ file_id, - - file_type, - @@ -113,19 +107,16 @@ #{fileId,jdbcType=VARCHAR}, - - #{fileType,jdbcType=VARCHAR}, - - + select count(*) from load_test_file - update file_store_resource + update load_test_file test_id = #{record.testId,jdbcType=VARCHAR}, @@ -133,19 +124,15 @@ file_id = #{record.fileId,jdbcType=VARCHAR}, - - file_type = #{record.fileType,jdbcType=VARCHAR}, - - update file_store_resource + update load_test_file set test_id = #{record.testId,jdbcType=VARCHAR}, - file_id = #{record.fileId,jdbcType=VARCHAR}, - file_type = #{record.fileType,jdbcType=VARCHAR} + file_id = #{record.fileId,jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/metersphere/service/LoadTestService.java b/backend/src/main/java/io/metersphere/service/LoadTestService.java index 97a8d990ba..1321f50824 100644 --- a/backend/src/main/java/io/metersphere/service/LoadTestService.java +++ b/backend/src/main/java/io/metersphere/service/LoadTestService.java @@ -1,10 +1,7 @@ package io.metersphere.service; import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.FileStoreMapper; -import io.metersphere.base.mapper.FileStoreResourceMapper; -import io.metersphere.base.mapper.LoadTestMapper; -import io.metersphere.base.mapper.ProjectMapper; +import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtLoadTestMapper; import io.metersphere.commons.constants.LoadTestFileType; import io.metersphere.commons.exception.MSException; @@ -36,9 +33,11 @@ public class LoadTestService { @Resource private ProjectMapper projectMapper; @Resource - private FileStoreMapper fileStoreMapper; + private FileMetadataMapper fileMetadataMapper; @Resource - private FileStoreResourceMapper fileStoreResourceMapper; + private FileContentMapper fileContentMapper; + @Resource + private LoadTestFileMapper loadTestFileMapper; // 测试,模拟数据 @PostConstruct @@ -78,15 +77,14 @@ public class LoadTestService { throw new IllegalArgumentException("文件不能为空!"); } - final FileStore fileStore = saveFileStore(file); + final FileMetadata fileMetadata = saveFile(file); final LoadTestWithBLOBs loadTest = saveLoadTest(request); - FileStoreResource fileStoreResource = new FileStoreResource(); - fileStoreResource.setTestId(loadTest.getId()); - fileStoreResource.setFileId(fileStore.getId()); - fileStoreResource.setFileType(fileStore.getType()); - fileStoreResourceMapper.insert(fileStoreResource); + LoadTestFile loadTestFile = new LoadTestFile(); + loadTestFile.setTestId(loadTest.getId()); + loadTestFile.setFileId(fileMetadata.getId()); + loadTestFileMapper.insert(loadTestFile); } private LoadTestWithBLOBs saveLoadTest(SaveTestPlanRequest request) { @@ -102,20 +100,25 @@ public class LoadTestService { return loadTest; } - private FileStore saveFileStore(MultipartFile file) { - final FileStore fileStore = new FileStore(); - fileStore.setId(UUID.randomUUID().toString()); - fileStore.setName(file.getOriginalFilename()); - fileStore.setSize(file.getSize()); - fileStore.setCreateTime(System.currentTimeMillis()); - fileStore.setUpdateTime(System.currentTimeMillis()); - fileStore.setType(LoadTestFileType.JMX.name()); + private FileMetadata saveFile(MultipartFile file) { + final FileMetadata fileMetadata = new FileMetadata(); + fileMetadata.setId(UUID.randomUUID().toString()); + fileMetadata.setName(file.getOriginalFilename()); + fileMetadata.setSize(file.getSize()); + fileMetadata.setCreateTime(System.currentTimeMillis()); + fileMetadata.setUpdateTime(System.currentTimeMillis()); + fileMetadata.setType(LoadTestFileType.JMX.name()); + fileMetadataMapper.insert(fileMetadata); + + FileContent fileContent = new FileContent(); + fileContent.setId(fileMetadata.getId()); try { - fileStore.setFile(IOUtils.toString(file.getInputStream(), StandardCharsets.UTF_8)); + fileContent.setFile(IOUtils.toString(file.getInputStream(), StandardCharsets.UTF_8)); } catch (IOException e) { MSException.throwException(e); } - fileStoreMapper.insert(fileStore); - return fileStore; + fileContentMapper.insert(fileContent); + + return fileMetadata; } } diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 16f1f93000..314fa8e22c 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -56,7 +56,8 @@
-
-
+
+
+
\ No newline at end of file