feat(性能测试): 上传的文件保证顺序
This commit is contained in:
parent
540183f5b8
commit
3a7a37bc19
|
@ -18,5 +18,7 @@ public class FileMetadata implements Serializable {
|
|||
|
||||
private Long size;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -175,142 +175,142 @@ public class FileMetadataExample {
|
|||
}
|
||||
|
||||
public Criteria andNameIsNull() {
|
||||
addCriterion("name is null");
|
||||
addCriterion("`name` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("name is not null");
|
||||
addCriterion("`name` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("name =", value, "name");
|
||||
addCriterion("`name` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("name <>", value, "name");
|
||||
addCriterion("`name` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("name >", value, "name");
|
||||
addCriterion("`name` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("name >=", value, "name");
|
||||
addCriterion("`name` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("name <", value, "name");
|
||||
addCriterion("`name` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("name <=", value, "name");
|
||||
addCriterion("`name` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("name like", value, "name");
|
||||
addCriterion("`name` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("name not like", value, "name");
|
||||
addCriterion("`name` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("name in", values, "name");
|
||||
addCriterion("`name` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("name not in", values, "name");
|
||||
addCriterion("`name` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("name between", value1, value2, "name");
|
||||
addCriterion("`name` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("name not between", value1, value2, "name");
|
||||
addCriterion("`name` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("type is null");
|
||||
addCriterion("`type` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("type is not null");
|
||||
addCriterion("`type` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(String value) {
|
||||
addCriterion("type =", value, "type");
|
||||
addCriterion("`type` =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(String value) {
|
||||
addCriterion("type <>", value, "type");
|
||||
addCriterion("`type` <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(String value) {
|
||||
addCriterion("type >", value, "type");
|
||||
addCriterion("`type` >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("type >=", value, "type");
|
||||
addCriterion("`type` >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(String value) {
|
||||
addCriterion("type <", value, "type");
|
||||
addCriterion("`type` <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("type <=", value, "type");
|
||||
addCriterion("`type` <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLike(String value) {
|
||||
addCriterion("type like", value, "type");
|
||||
addCriterion("`type` like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotLike(String value) {
|
||||
addCriterion("type not like", value, "type");
|
||||
addCriterion("`type` not like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<String> values) {
|
||||
addCriterion("type in", values, "type");
|
||||
addCriterion("`type` in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<String> values) {
|
||||
addCriterion("type not in", values, "type");
|
||||
addCriterion("`type` not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(String value1, String value2) {
|
||||
addCriterion("type between", value1, value2, "type");
|
||||
addCriterion("`type` between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("type not between", value1, value2, "type");
|
||||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
|
@ -435,62 +435,122 @@ public class FileMetadataExample {
|
|||
}
|
||||
|
||||
public Criteria andSizeIsNull() {
|
||||
addCriterion("size is null");
|
||||
addCriterion("`size` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeIsNotNull() {
|
||||
addCriterion("size is not null");
|
||||
addCriterion("`size` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeEqualTo(Long value) {
|
||||
addCriterion("size =", value, "size");
|
||||
addCriterion("`size` =", value, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeNotEqualTo(Long value) {
|
||||
addCriterion("size <>", value, "size");
|
||||
addCriterion("`size` <>", value, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeGreaterThan(Long value) {
|
||||
addCriterion("size >", value, "size");
|
||||
addCriterion("`size` >", value, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("size >=", value, "size");
|
||||
addCriterion("`size` >=", value, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeLessThan(Long value) {
|
||||
addCriterion("size <", value, "size");
|
||||
addCriterion("`size` <", value, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("size <=", value, "size");
|
||||
addCriterion("`size` <=", value, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeIn(List<Long> values) {
|
||||
addCriterion("size in", values, "size");
|
||||
addCriterion("`size` in", values, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeNotIn(List<Long> values) {
|
||||
addCriterion("size not in", values, "size");
|
||||
addCriterion("`size` not in", values, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeBetween(Long value1, Long value2) {
|
||||
addCriterion("size between", value1, value2, "size");
|
||||
addCriterion("`size` between", value1, value2, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSizeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("size not between", value1, value2, "size");
|
||||
addCriterion("`size` not between", value1, value2, "size");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortIsNull() {
|
||||
addCriterion("sort is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortIsNotNull() {
|
||||
addCriterion("sort is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortEqualTo(Integer value) {
|
||||
addCriterion("sort =", value, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortNotEqualTo(Integer value) {
|
||||
addCriterion("sort <>", value, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortGreaterThan(Integer value) {
|
||||
addCriterion("sort >", value, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("sort >=", value, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortLessThan(Integer value) {
|
||||
addCriterion("sort <", value, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("sort <=", value, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortIn(List<Integer> values) {
|
||||
addCriterion("sort in", values, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortNotIn(List<Integer> values) {
|
||||
addCriterion("sort not in", values, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortBetween(Integer value1, Integer value2) {
|
||||
addCriterion("sort between", value1, value2, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSortNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("sort not between", value1, value2, "sort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="size" jdbcType="BIGINT" property="size" />
|
||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -68,7 +69,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, name, type, create_time, update_time, size
|
||||
id, `name`, `type`, create_time, update_time, `size`, sort
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.FileMetadataExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -101,12 +102,12 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.FileMetadata">
|
||||
insert into file_metadata (id, name, type,
|
||||
create_time, update_time, size
|
||||
)
|
||||
insert into file_metadata (id, `name`, `type`,
|
||||
create_time, update_time, `size`,
|
||||
sort)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{size,jdbcType=BIGINT}
|
||||
)
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{size,jdbcType=BIGINT},
|
||||
#{sort,jdbcType=INTEGER})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.FileMetadata">
|
||||
insert into file_metadata
|
||||
|
@ -115,10 +116,10 @@
|
|||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
`name`,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type,
|
||||
`type`,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
|
@ -127,7 +128,10 @@
|
|||
update_time,
|
||||
</if>
|
||||
<if test="size != null">
|
||||
size,
|
||||
`size`,
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
@ -149,6 +153,9 @@
|
|||
<if test="size != null">
|
||||
#{size,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
#{sort,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.FileMetadataExample" resultType="java.lang.Long">
|
||||
|
@ -164,10 +171,10 @@
|
|||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
type = #{record.type,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
|
@ -176,7 +183,10 @@
|
|||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.size != null">
|
||||
size = #{record.size,jdbcType=BIGINT},
|
||||
`size` = #{record.size,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.sort != null">
|
||||
sort = #{record.sort,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
|
@ -186,11 +196,12 @@
|
|||
<update id="updateByExample" parameterType="map">
|
||||
update file_metadata
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
type = #{record.type,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
size = #{record.size,jdbcType=BIGINT}
|
||||
`size` = #{record.size,jdbcType=BIGINT},
|
||||
sort = #{record.sort,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -199,10 +210,10 @@
|
|||
update file_metadata
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
|
@ -211,18 +222,22 @@
|
|||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="size != null">
|
||||
size = #{size,jdbcType=BIGINT},
|
||||
`size` = #{size,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.FileMetadata">
|
||||
update file_metadata
|
||||
set name = #{name,jdbcType=VARCHAR},
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
size = #{size,jdbcType=BIGINT}
|
||||
`size` = #{size,jdbcType=BIGINT},
|
||||
sort = #{sort,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -5,9 +5,11 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class EditTestPlanRequest extends TestPlanRequest {
|
||||
private List<FileMetadata> updatedFileList;
|
||||
private Map<String, Integer> fileSorts;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class SaveTestPlanRequest extends TestPlanRequest {
|
||||
private List<FileMetadata> updatedFileList;
|
||||
private Map<String, Integer> fileSorts;
|
||||
}
|
||||
|
|
|
@ -135,36 +135,37 @@ public class PerformanceTestService {
|
|||
List<FileMetadata> importFiles = request.getUpdatedFileList();
|
||||
List<String> importFileIds = importFiles.stream().map(FileMetadata::getId).collect(Collectors.toList());
|
||||
// 导入项目里其他的文件
|
||||
this.importFiles(importFileIds, loadTest.getId());
|
||||
this.importFiles(importFileIds, loadTest.getId(), request.getFileSorts());
|
||||
// 保存上传的文件
|
||||
this.saveUploadFiles(files, loadTest.getId());
|
||||
this.saveUploadFiles(files, loadTest.getId(), request.getFileSorts());
|
||||
|
||||
return loadTest.getId();
|
||||
}
|
||||
|
||||
private void saveUploadFiles(List<MultipartFile> files, String testId) {
|
||||
private void saveUploadFiles(List<MultipartFile> files, String testId, Map<String, Integer> fileSorts) {
|
||||
if (files != null) {
|
||||
files.forEach(file -> {
|
||||
final FileMetadata fileMetadata = fileService.saveFile(file);
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
MultipartFile file = files.get(i);
|
||||
final FileMetadata fileMetadata = fileService.saveFile(file, fileSorts.getOrDefault(file.getOriginalFilename(), i));
|
||||
LoadTestFile loadTestFile = new LoadTestFile();
|
||||
loadTestFile.setTestId(testId);
|
||||
loadTestFile.setFileId(fileMetadata.getId());
|
||||
loadTestFileMapper.insert(loadTestFile);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void importFiles(List<String> importFileIds, String testId) {
|
||||
importFileIds.forEach(fileId -> {
|
||||
if (StringUtils.isBlank(fileId)) {
|
||||
return;
|
||||
}
|
||||
private void importFiles(List<String> importFileIds, String testId, Map<String, Integer> fileSorts) {
|
||||
for (int i = 0; i < importFileIds.size(); i++) {
|
||||
String fileId = importFileIds.get(i);
|
||||
FileMetadata fileMetadata = fileService.copyFile(fileId);
|
||||
fileMetadata.setSort(fileSorts.getOrDefault(fileMetadata.getName(), i));
|
||||
fileService.updateFileMetadata(fileMetadata);
|
||||
LoadTestFile loadTestFile = new LoadTestFile();
|
||||
loadTestFile.setTestId(testId);
|
||||
loadTestFile.setFileId(fileMetadata.getId());
|
||||
loadTestFileMapper.insert(loadTestFile);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private LoadTestWithBLOBs saveLoadTest(SaveTestPlanRequest request) {
|
||||
|
@ -211,8 +212,8 @@ public class PerformanceTestService {
|
|||
fileService.deleteFileByIds(deleteFileIds);
|
||||
// 导入项目里其他的文件
|
||||
List<String> addFileIds = ListUtils.subtract(updatedFileIds, originFileIds);
|
||||
this.importFiles(addFileIds, request.getId());
|
||||
this.saveUploadFiles(files, request.getId());
|
||||
this.importFiles(addFileIds, request.getId(), request.getFileSorts());
|
||||
this.saveUploadFiles(files, request.getId(), request.getFileSorts());
|
||||
|
||||
loadTest.setName(request.getName());
|
||||
loadTest.setProjectId(request.getProjectId());
|
||||
|
|
|
@ -47,6 +47,7 @@ public class FileService {
|
|||
List<String> fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
|
||||
FileMetadataExample example = new FileMetadataExample();
|
||||
example.createCriteria().andIdIn(fileIds);
|
||||
example.setOrderByClause("sort asc"); // 安装顺序排序
|
||||
return fileMetadataMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
|
@ -85,6 +86,10 @@ public class FileService {
|
|||
}
|
||||
|
||||
public FileMetadata saveFile(MultipartFile file) {
|
||||
return saveFile(file, 0);
|
||||
}
|
||||
|
||||
public FileMetadata saveFile(MultipartFile file, Integer sort) {
|
||||
final FileMetadata fileMetadata = new FileMetadata();
|
||||
fileMetadata.setId(UUID.randomUUID().toString());
|
||||
fileMetadata.setName(file.getOriginalFilename());
|
||||
|
@ -93,6 +98,7 @@ public class FileService {
|
|||
fileMetadata.setUpdateTime(System.currentTimeMillis());
|
||||
FileType fileType = getFileType(fileMetadata.getName());
|
||||
fileMetadata.setType(fileType.name());
|
||||
fileMetadata.setSort(sort);
|
||||
fileMetadataMapper.insert(fileMetadata);
|
||||
|
||||
FileContent fileContent = new FileContent();
|
||||
|
@ -107,7 +113,7 @@ public class FileService {
|
|||
return fileMetadata;
|
||||
}
|
||||
|
||||
public FileMetadata saveFile(byte[] fileByte,String fileName,Long fileSize) {
|
||||
public FileMetadata saveFile(byte[] fileByte, String fileName, Long fileSize) {
|
||||
final FileMetadata fileMetadata = new FileMetadata();
|
||||
fileMetadata.setId(UUID.randomUUID().toString());
|
||||
fileMetadata.setName(fileName);
|
||||
|
@ -175,4 +181,8 @@ public class FileService {
|
|||
fileMetadataMapper.selectByExample(example);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateFileMetadata(FileMetadata fileMetadata) {
|
||||
fileMetadataMapper.updateByPrimaryKeySelective(fileMetadata);
|
||||
}
|
||||
}
|
|
@ -27,5 +27,8 @@ CREATE TABLE IF NOT EXISTS `api_document_share` (
|
|||
INDEX `share_api_id`(`share_api_id`(125)) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- test_case_review add coloumn
|
||||
ALTER TABLE test_case_review ADD tags VARCHAR(2000) NULL;
|
||||
-- test_case_review add column
|
||||
ALTER TABLE test_case_review ADD tags VARCHAR(2000) NULL;
|
||||
|
||||
-- file add sort column
|
||||
alter table file_metadata add sort int default 0;
|
|
@ -190,6 +190,7 @@ export default {
|
|||
}
|
||||
// 基本配置
|
||||
this.test.updatedFileList = this.$refs.basicConfig.updatedFileList();
|
||||
this.test.fileSorts = this.$refs.basicConfig.fileSorts();
|
||||
// 压力配置
|
||||
this.test.loadConfiguration = JSON.stringify(this.$refs.pressureConfig.convertProperty());
|
||||
this.test.testResourcePoolId = this.$refs.pressureConfig.resourcePool;
|
||||
|
|
|
@ -121,7 +121,6 @@ export default {
|
|||
|
||||
if (this.loadType === 'resource') {
|
||||
rows.forEach(row => {
|
||||
this.fileList.push(row);
|
||||
this.tableData.push(row);
|
||||
})
|
||||
this.$success(this.$t('test_track.case.import.success'));
|
||||
|
@ -142,7 +141,6 @@ export default {
|
|||
this.scenarios.push(tg);
|
||||
});
|
||||
let file = new File([d.jmx], d.name);
|
||||
this.fileList.push(file);
|
||||
this.uploadList.push(file);
|
||||
this.tableData.push({
|
||||
name: file.name,
|
||||
|
|
|
@ -138,7 +138,6 @@ export default {
|
|||
this.scenarios.push(tg);
|
||||
});
|
||||
let file = new File([d.jmx], d.name + ".jmx");
|
||||
this.fileList.push(file);
|
||||
this.uploadList.push(file);
|
||||
this.tableData.push({
|
||||
name: file.name,
|
||||
|
|
|
@ -348,6 +348,13 @@ export default {
|
|||
updatedFileList() {
|
||||
return this.fileList;// 表示修改了已经上传的文件列表
|
||||
},
|
||||
fileSorts() {
|
||||
let fileSorts = {};
|
||||
this.tableData.forEach((f, index) => {
|
||||
fileSorts[f.name] = index;
|
||||
});
|
||||
return fileSorts;
|
||||
},
|
||||
loadJMX() {
|
||||
this.$refs.existFiles.open('jmx');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue