fix(性能测试): 性能测试查找附件不再限制文件格式

--bug=1029674 --user=宋天阳
【性能测试】github#26460,【性能测试】性能测试-资源文件处,上传.dat文件,提示上传成功,但是下面并没有显示出对应文件
https://www.tapd.cn/55049933/s/1411099
This commit is contained in:
song-tianyang 2023-09-01 15:44:33 +08:00 committed by fit2-zhao
parent 52deefe6fc
commit e4d6984e6d
3 changed files with 27 additions and 28 deletions

View File

@ -369,11 +369,15 @@
<select id="getProjectFiles" resultType="io.metersphere.base.domain.FileMetadata"> <select id="getProjectFiles" resultType="io.metersphere.base.domain.FileMetadata">
SELECT file_metadata.* SELECT file_metadata.*
FROM file_metadata FROM file_metadata
WHERE file_metadata.type IN WHERE
<foreach collection="loadTypes" item="id" separator="," open="(" close=")"> project_id = #{projectId,jdbcType=VARCHAR}
#{id} <if test="loadTypes != null and loadTypes.size() > 0">
</foreach> AND file_metadata.type IN
AND project_id = #{projectId,jdbcType=VARCHAR} <foreach collection="loadTypes" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</if>
<if test="request.name != null"> <if test="request.name != null">
AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%') AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%')
</if> </if>

View File

@ -752,17 +752,17 @@ public class PerformanceTestService {
} }
public List<FileMetadata> getProjectFiles(String projectId, String loadType, QueryProjectFileRequest request) { public List<FileMetadata> getProjectFiles(String projectId, String loadType, QueryProjectFileRequest request) {
List<String> loadTypes = new ArrayList<>();
loadTypes.add(StringUtils.upperCase(loadType));
if (StringUtils.equalsIgnoreCase(loadType, "resource")) { if (StringUtils.equalsIgnoreCase(loadType, "resource")) {
List<String> fileTypes = Arrays.stream(FileType.values()).filter(fileType -> !fileType.equals(FileType.JMX)).map(FileType::name).collect(Collectors.toList()); return extLoadTestMapper.getProjectFiles(projectId, null, request);
loadTypes.addAll(fileTypes); } else {
List<String> loadTypes = new ArrayList<>();
loadTypes.add(StringUtils.upperCase(loadType));
if (StringUtils.equalsIgnoreCase(loadType, "all")) {
List<String> fileTypes = Arrays.stream(FileType.values()).map(FileType::name).collect(Collectors.toList());
loadTypes.addAll(fileTypes);
}
return extLoadTestMapper.getProjectFiles(projectId, loadTypes, request);
} }
if (StringUtils.equalsIgnoreCase(loadType, "all")) {
List<String> fileTypes = Arrays.stream(FileType.values()).map(FileType::name).collect(Collectors.toList());
loadTypes.addAll(fileTypes);
}
return extLoadTestMapper.getProjectFiles(projectId, loadTypes, request);
} }
public List<LoadTestExportJmx> exportJmx(List<String> fileIds) { public List<LoadTestExportJmx> exportJmx(List<String> fileIds) {

View File

@ -179,21 +179,16 @@ export default {
}); });
} }
}, },
handleSelectionChange(selection, row) { handleSelectionChange(selection, clickRow) {
if (this.selectIds.has(row.id)) { this.selectIds = new Set;
this.selectIds.delete(row.id); this.selectFiles = [];
for (let i = 0; i < this.selectFiles.length - 1; i++) { if (selection.length != 0) {
if (this.selectFiles[i].id === row.id) { selection.forEach(row => {
this.selectFiles.splice(i, 1);
}
}
} else {
if (!this.selectIds.has(row.id)) {
this.selectIds.add(row.id); this.selectIds.add(row.id);
} if (this.selectFiles.filter(f => f.id === row.id).length === 0) {
if (this.selectFiles.filter(f => f.id === row.id).length === 0) { this.selectFiles.push(row);
this.selectFiles.push(row); }
} })
} }
}, },
getProjectFiles() { getProjectFiles() {