feat(UI测试): UI测试初版 (#11887)

* feat: ui first commit

* feat: mvp 指令解析引擎

* feat: UI 单元测试

* feat: ui路由

* feat(ui): selenium 部分指令翻译

* feat: 添加remoteDriver依赖

* feat: 首次提交sql,前后端接口

* fix: 接口调用恶意删除文件漏洞

* fix: 测试计划性能测试用例order字段初始化报错

* feat: UiScenario转换工具类

* feat: ui 列表页部分代码

* feat: 导入的部分代码

* fix: 打开百度demo

* refactor: 修改字段名称

* refactor: 重构模块树后端

* feat: 编辑 ui 页面数据

* fix: 模块通用操作

* feat: 通用方法模块操作增加方法

* feat: 添加元素管理列表字段

* feat: 元素库相关

* feat: 创建ui自动化引用关系表

* fix: 模块树操作框

* fix: 解決一些控制台报错

* feat: 前端定义,精细化 locator 组件,动态组件通过 v-model 双向绑定

* feat: ui场景编辑页面左侧步骤编辑

* build: 统一字符集

* feat: ui场景报告复用接口场景报告

* refactor: argtype类

* feat: 指令结构解析,json-schema引入

* feat: UI场景debug接口

* feat: ui报告处理

* feat: 保存ui测试场景

* build: 修改ignore

* refactor: 基本信息保存

* feat: ui场景编辑页元素库相关

* feat: vuex mutaions,添加普通指令

* feat: 其他参数组件,以及部分重构

* feat: ui场景执行生成报告

* fix: 截图名称,添加新指令类型

* refactor: 模块管理中增加UI开关

* fix:左侧步骤样式美化

* fix:解决 locator 报错。以及步骤数报错

* fix: commandConfig 前后置指令

* fix: 测试用例api

* refactor(ui): 注入脚本全局配置参数以及单个脚本配置参数

* fix(ui): 测试用例修改

* feat: ui报告细节优化

* feat: ui报告细节

* fix: 接口报告列表展示了ui的报告

* fix: sync xpack

Co-authored-by: zhangdahai112 <dahai.zhang@fit2cloud.com>
Co-authored-by: junhong <junhong.zhou@fit2cloud.com>
Co-authored-by: AnAngle <1323481023@qq.com>
Co-authored-by: chenjianxing <jianxing.chen@fit2cloud.com>
Co-authored-by: CaptainB <bin@fit2cloud.com>
This commit is contained in:
metersphere-bot 2022-03-23 19:42:55 +08:00 committed by GitHub
parent 246d77fcea
commit 35da82ee6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 8811 additions and 163 deletions

2
backend/.gitignore vendored
View File

@ -26,6 +26,8 @@ yarn-error.log*
src/main/resources/static src/main/resources/static
src/main/resources/public src/main/resources/public
src/main/resources/application.properties
src/test/ src/test/
target target
.settings .settings

View File

@ -91,6 +91,23 @@
<artifactId>spring-boot-starter-validation</artifactId> <artifactId>spring-boot-starter-validation</artifactId>
</dependency> </dependency>
<!-- 后续考虑移到jmeter core -->
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-webdriver</artifactId>
<version>3.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
</exclusion>
<exclusion>
<artifactId>slf4j-nop</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- flyway --> <!-- flyway -->
<dependency> <dependency>
<groupId>org.flywaydb</groupId> <groupId>org.flywaydb</groupId>
@ -341,6 +358,13 @@
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<version>31.0.1-jre</version> <version>31.0.1-jre</version>
</dependency> </dependency>
<!--java json schema json格式校验-->
<dependency>
<groupId>com.github.java-json-tools</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.2.14</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -350,6 +374,9 @@
<includes> <includes>
<include>**/*.properties</include> <include>**/*.properties</include>
<include>**/*.xml</include> <include>**/*.xml</include>
<include>**/*.json</include>
<include>**/*.tpl</include>
<include>**/*.js</include>
</includes> </includes>
<filtering>false</filtering> <filtering>false</filtering>
</resource> </resource>
@ -424,38 +451,38 @@
<version>2.6</version> <version>2.6</version>
</plugin> </plugin>
<plugin> <!-- <plugin>-->
<groupId>org.apache.maven.plugins</groupId> <!-- <groupId>org.apache.maven.plugins</groupId>-->
<artifactId>maven-antrun-plugin</artifactId> <!-- <artifactId>maven-antrun-plugin</artifactId>-->
<executions> <!-- <executions>-->
<execution> <!-- <execution>-->
<id>main-class-placement</id> <!-- <id>main-class-placement</id>-->
<phase>generate-resources</phase> <!-- <phase>generate-resources</phase>-->
<configuration> <!-- <configuration>-->
<target> <!-- <target>-->
<move todir="src/main/resources/static"> <!-- <move todir="src/main/resources/static">-->
<fileset dir="../frontend/dist"> <!-- <fileset dir="../frontend/dist">-->
<exclude name="*.html"/> <!-- <exclude name="*.html"/>-->
</fileset> <!-- </fileset>-->
</move> <!-- </move>-->
<move todir="src/main/resources/public"> <!-- <move todir="src/main/resources/public">-->
<fileset dir="../frontend/dist"> <!-- <fileset dir="../frontend/dist">-->
<include name="*.html"/> <!-- <include name="*.html"/>-->
</fileset> <!-- </fileset>-->
</move> <!-- </move>-->
<copy todir="src/main/resources/static/css"> <!-- <copy todir="src/main/resources/static/css">-->
<fileset dir="../frontend/src/assets/theme"> <!-- <fileset dir="../frontend/src/assets/theme">-->
<include name="index.css"/> <!-- <include name="index.css"/>-->
</fileset> <!-- </fileset>-->
</copy> <!-- </copy>-->
</target> <!-- </target>-->
</configuration> <!-- </configuration>-->
<goals> <!-- <goals>-->
<goal>run</goal> <!-- <goal>run</goal>-->
</goals> <!-- </goals>-->
</execution> <!-- </execution>-->
</executions> <!-- </executions>-->
</plugin> <!-- </plugin>-->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>

View File

@ -16,6 +16,7 @@ public class QueryAPIReportRequest {
private String name; private String name;
private String workspaceId; private String workspaceId;
private String userId; private String userId;
private String reportType;
private boolean recent = false; private boolean recent = false;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;

View File

@ -19,6 +19,7 @@ import io.metersphere.jmeter.utils.ScriptEngineUtils;
import io.metersphere.plugin.core.MsParameter; import io.metersphere.plugin.core.MsParameter;
import io.metersphere.plugin.core.MsTestElement; import io.metersphere.plugin.core.MsTestElement;
import io.metersphere.track.service.TestPlanApiCaseService; import io.metersphere.track.service.TestPlanApiCaseService;
import io.metersphere.xpack.ui.impl.CommandConfig;
import lombok.Data; import lombok.Data;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -32,6 +33,11 @@ public class ParameterConfig extends MsParameter {
* 环境配置 * 环境配置
*/ */
private Map<String, EnvironmentConfig> config; private Map<String, EnvironmentConfig> config;
/**
* UI 指令全局配置
*/
private CommandConfig commandConfig;
/** /**
* 缓存同一批请求的认证信息 * 缓存同一批请求的认证信息
*/ */
@ -194,4 +200,32 @@ public class ParameterConfig extends MsParameter {
} }
} }
} }
public void setHeader(String name, String value) {
if (StringUtils.isEmpty(name)) {
return;
}
if (CollectionUtils.isEmpty(headers)) {
headers = new LinkedList<>();
}
for (KeyValue kv : headers) {
if (StringUtils.equalsIgnoreCase(kv.getName(), name)) {
kv.setValue(value);
return;
}
}
KeyValue kv = new KeyValue(name, value);
headers.add(kv);
}
public KeyValue getHeader(String name) {
if (StringUtils.isNotEmpty(name) && CollectionUtils.isNotEmpty(headers)) {
for (KeyValue kv : headers) {
if (StringUtils.equalsIgnoreCase(kv.getName(), name)) {
return kv;
}
}
}
return null;
}
} }

View File

@ -27,6 +27,7 @@ import io.metersphere.dto.RunModeConfigDTO;
import io.metersphere.plugin.core.MsTestElement; import io.metersphere.plugin.core.MsTestElement;
import io.metersphere.service.EnvironmentGroupProjectService; import io.metersphere.service.EnvironmentGroupProjectService;
import io.metersphere.vo.BooleanPool; import io.metersphere.vo.BooleanPool;
import io.metersphere.xpack.ui.hashtree.MsUiScenario;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.jorphan.collections.HashTree; import org.apache.jorphan.collections.HashTree;
@ -71,6 +72,36 @@ public class GenerateHashTreeUtil {
} }
} }
public static MsUiScenario parseUiScenario(String scenarioDefinition) {
MsUiScenario msUiScenario = JSONObject.parseObject(scenarioDefinition, MsUiScenario.class);
parseUiScenario(scenarioDefinition, msUiScenario);
return msUiScenario;
}
public static void parseUiScenario(String scenarioDefinition, MsUiScenario scenario) {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
JSONObject element = JSON.parseObject(scenarioDefinition);
ElementUtil.dataFormatting(element);
// 多态JSON普通转换会丢失内容需要通过 ObjectMapper 获取
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
new TypeReference<LinkedList<MsTestElement>>() {
});
scenario.setHashTree(elements);
}
if (element != null && StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
scenario.setVariables(variables);
}
} catch (Exception e) {
LogUtil.error(e);
}
}
public static LinkedList<MsTestElement> getScenarioHashTree(String definition) { public static LinkedList<MsTestElement> getScenarioHashTree(String definition) {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

View File

@ -1,6 +1,7 @@
package io.metersphere.api.service; package io.metersphere.api.service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.ErrorReportLibraryParseDTO; import io.metersphere.api.dto.ErrorReportLibraryParseDTO;
import io.metersphere.base.domain.ApiScenarioReportResult; import io.metersphere.base.domain.ApiScenarioReportResult;
import io.metersphere.base.mapper.ApiScenarioReportResultMapper; import io.metersphere.base.mapper.ApiScenarioReportResultMapper;
@ -64,6 +65,34 @@ public class ApiScenarioReportResultService {
} }
} }
public void uiSave(String reportId, List<RequestResult> queue) {
if (CollectionUtils.isNotEmpty(queue)) {
queue.forEach(item -> {
String header = item.getResponseResult().getHeaders();
if (StringUtils.isNoneBlank(header)) {
JSONObject jsonObject = JSONObject.parseObject(header);
for (String resourceId : jsonObject.keySet()) {
apiScenarioReportResultMapper.insert(this.newUiScenarioReportResult(reportId, resourceId, jsonObject.get(resourceId).toString()));
}
}
});
}
}
private ApiScenarioReportResult newUiScenarioReportResult(String reportId, String resourceId, String value) {
ApiScenarioReportResult report = new ApiScenarioReportResult();
report.setId(UUID.randomUUID().toString());
report.setResourceId(resourceId);
report.setReportId(reportId);
report.setTotalAssertions(0L);
report.setPassAssertions(0L);
report.setCreateTime(System.currentTimeMillis());
String status = value.equalsIgnoreCase("OK") ? ExecuteResult.Success.name() : ExecuteResult.Error.name();
report.setStatus(status);
report.setContent(value.getBytes(StandardCharsets.UTF_8));
return report;
}
private ApiScenarioReportResult newApiScenarioReportResult(String reportId, RequestResult baseResult) { private ApiScenarioReportResult newApiScenarioReportResult(String reportId, RequestResult baseResult) {
ApiScenarioReportResult report = new ApiScenarioReportResult(); ApiScenarioReportResult report = new ApiScenarioReportResult();
//解析误报内容 //解析误报内容

View File

@ -60,6 +60,8 @@ public class ApiScenarioReportService {
@Resource @Resource
private ApiScenarioMapper apiScenarioMapper; private ApiScenarioMapper apiScenarioMapper;
@Resource @Resource
private UiScenarioMapper uiScenarioMapper;
@Resource
private TestPlanApiScenarioMapper testPlanApiScenarioMapper; private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
@Resource @Resource
private NoticeSendService noticeSendService; private NoticeSendService noticeSendService;
@ -83,10 +85,16 @@ public class ApiScenarioReportService {
apiScenarioReportResultService.save(dto.getReportId(), requestResults); apiScenarioReportResultService.save(dto.getReportId(), requestResults);
} }
public void batchSaveResult(List<ResultDTO> dtos) { public void batchSaveResult(List<ResultDTO> dtos) {
apiScenarioReportResultService.batchSave(dtos); apiScenarioReportResultService.batchSave(dtos);
} }
public void saveUiResult(List<RequestResult> requestResults, ResultDTO dto) {
// 报告详情内容
apiScenarioReportResultService.uiSave(dto.getReportId(), requestResults);
}
public ApiScenarioReport testEnded(ResultDTO dto) { public ApiScenarioReport testEnded(ResultDTO dto) {
if (!StringUtils.equals(dto.getReportType(), RunModeConstants.SET_REPORT.toString())) { if (!StringUtils.equals(dto.getReportType(), RunModeConstants.SET_REPORT.toString())) {
// 更新控制台信息 // 更新控制台信息
@ -109,6 +117,8 @@ public class ApiScenarioReportService {
scenarioReport = updatePlanCase(requestResults, dto); scenarioReport = updatePlanCase(requestResults, dto);
} else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) { } else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
scenarioReport = updateSchedulePlanCase(requestResults, dto); scenarioReport = updateSchedulePlanCase(requestResults, dto);
} else if (dto.getRunMode().startsWith("UI")) {
scenarioReport = updateUiScenario(requestResults, dto);
} else { } else {
scenarioReport = updateScenario(requestResults, dto); scenarioReport = updateScenario(requestResults, dto);
} }
@ -397,6 +407,42 @@ public class ApiScenarioReportService {
return report; return report;
} }
public ApiScenarioReport updateUiScenario(List<ApiScenarioReportResult> requestResults, ResultDTO dto) {
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Error.name())).count();
// 更新报告状态
String status = getStatus(requestResults, dto);
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), status, dto.getRunMode());
// 更新场景状态
UiScenarioWithBLOBs scenario = uiScenarioMapper.selectByPrimaryKey(dto.getTestId());
if (scenario == null) {
scenario = uiScenarioMapper.selectByPrimaryKey(report.getScenarioId());
}
if (scenario != null) {
if (StringUtils.equalsAnyIgnoreCase(status, ExecuteResult.errorReportResult.name())) {
scenario.setLastResult(status);
} else {
scenario.setLastResult(errorSize > 0 ? "Fail" : ScenarioStatus.Success.name());
}
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
scenario.setPassRate(new DecimalFormat("0%").format((float) successSize / requestResults.size()));
scenario.setReportId(dto.getReportId());
int executeTimes = 0;
if (scenario.getExecuteTimes() != null) {
executeTimes = scenario.getExecuteTimes().intValue();
}
scenario.setExecuteTimes(executeTimes + 1);
uiScenarioMapper.updateByPrimaryKey(scenario);
}
// // 发送通知
// if (scenario != null && report != null) {
// sendNotice(scenario, report);
// }
return report;
}
public String getEnvironment(ApiScenarioWithBLOBs apiScenario) { public String getEnvironment(ApiScenarioWithBLOBs apiScenario) {
String environment = "未配置"; String environment = "未配置";
String environmentType = apiScenario.getEnvironmentType(); String environmentType = apiScenario.getEnvironmentType();

View File

@ -56,6 +56,18 @@ public class ApiScenarioReportStructureService {
this.save(reportId, dtoList); this.save(reportId, dtoList);
} }
public void saveUi(List<UiScenarioWithBLOBs> uiScenarios, String reportId, String reportType) {
List<StepTreeDTO> dtoList = new LinkedList<>();
for (UiScenarioWithBLOBs bos : uiScenarios) {
StepTreeDTO dto = dataFormatting(bos, reportType);
dtoList.add(dto);
}
if (LoggerUtil.getLogger().isDebugEnabled()) {
LoggerUtil.debug("UI Scenario run-执行脚本装载-生成场景报告结构:" + JSON.toJSONString(dtoList));
}
this.save(reportId, dtoList);
}
public void save(ApiScenarioWithBLOBs apiScenario, String reportId, String reportType) { public void save(ApiScenarioWithBLOBs apiScenario, String reportId, String reportType) {
List<StepTreeDTO> dtoList = new LinkedList<>(); List<StepTreeDTO> dtoList = new LinkedList<>();
StepTreeDTO dto = dataFormatting(apiScenario, reportType); StepTreeDTO dto = dataFormatting(apiScenario, reportType);
@ -63,6 +75,13 @@ public class ApiScenarioReportStructureService {
this.save(reportId, dtoList); this.save(reportId, dtoList);
} }
public void save(UiScenarioWithBLOBs uiScenario, String reportId, String reportType) {
List<StepTreeDTO> dtoList = new LinkedList<>();
StepTreeDTO dto = dataFormatting(uiScenario, reportType);
dtoList.add(dto);
this.save(reportId, dtoList);
}
public void save(String reportId, List<StepTreeDTO> dtoList) { public void save(String reportId, List<StepTreeDTO> dtoList) {
ApiScenarioReportStructureWithBLOBs structure = new ApiScenarioReportStructureWithBLOBs(); ApiScenarioReportStructureWithBLOBs structure = new ApiScenarioReportStructureWithBLOBs();
structure.setId(UUID.randomUUID().toString()); structure.setId(UUID.randomUUID().toString());
@ -83,7 +102,15 @@ public class ApiScenarioReportStructureService {
} }
public static StepTreeDTO dataFormatting(ApiScenarioWithBLOBs apiScenario, String reportType) { public static StepTreeDTO dataFormatting(ApiScenarioWithBLOBs apiScenario, String reportType) {
JSONObject element = JSON.parseObject(apiScenario.getScenarioDefinition()); return dataFormatting(apiScenario.getId(), apiScenario.getName(), apiScenario.getScenarioDefinition(), reportType);
}
public static StepTreeDTO dataFormatting(UiScenarioWithBLOBs uiScenario, String reportType) {
return dataFormatting(uiScenario.getId(), uiScenario.getName(), uiScenario.getScenarioDefinition(), reportType);
}
public static StepTreeDTO dataFormatting(String id, String name, String scenarioDefinition, String reportType) {
JSONObject element = JSON.parseObject(scenarioDefinition);
StepTreeDTO dto = null; StepTreeDTO dto = null;
if (element != null && element.getBoolean("enable")) { if (element != null && element.getBoolean("enable")) {
element = getRefElement(element); element = getRefElement(element);
@ -91,15 +118,15 @@ public class ApiScenarioReportStructureService {
? element.getString("id") : element.getString("resourceId"); ? element.getString("id") : element.getString("resourceId");
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) { if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) {
if (StringUtils.isNotEmpty(resourceId) && StringUtils.isNotEmpty(apiScenario.getId()) && !resourceId.contains(apiScenario.getId())) { if (StringUtils.isNotEmpty(resourceId) && StringUtils.isNotEmpty(id) && !resourceId.contains(id)) {
resourceId = apiScenario.getId() + "=" + resourceId; resourceId = id + "=" + resourceId;
} }
} }
dto = new StepTreeDTO(apiScenario.getName(), resourceId, element.getString("type"), 1); dto = new StepTreeDTO(name, resourceId, element.getString("type"), 1);
dto.setAllIndex(null); dto.setAllIndex(null);
if (element.containsKey("hashTree") && !requests.contains(dto.getType())) { if (element.containsKey("hashTree") && !requests.contains(dto.getType())) {
JSONArray elementJSONArray = element.getJSONArray("hashTree"); JSONArray elementJSONArray = element.getJSONArray("hashTree");
dataFormatting(elementJSONArray, dto, apiScenario.getId(), reportType); dataFormatting(elementJSONArray, dto, id, reportType);
} }
} }
return dto; return dto;
@ -131,7 +158,10 @@ public class ApiScenarioReportStructureService {
} }
} }
StepTreeDTO children = new StepTreeDTO(element.getString("name"), resourceId, element.getString("type"), element.getIntValue("index")); StepTreeDTO children = new StepTreeDTO(element.getString("name"), resourceId, element.getString("type"), element.getIntValue("index"));
if (StringUtils.isNotEmpty(dto.getAllIndex())) { if (StringUtils.isNotBlank(children.getType()) && children.getType().equals("MsUiCommand")) {
children.setResourceId(resourceId);
children.setLabel(element.getString("command"));
} else if (StringUtils.isNotEmpty(dto.getAllIndex())) {
children.setAllIndex(dto.getAllIndex() + "_" + (children.getIndex() == 0 ? (i + 1) : children.getIndex())); children.setAllIndex(dto.getAllIndex() + "_" + (children.getIndex() == 0 ? (i + 1) : children.getIndex()));
children.setResourceId(resourceId + "_" + children.getAllIndex()); children.setResourceId(resourceId + "_" + children.getAllIndex());
} else { } else {
@ -182,7 +212,8 @@ public class ApiScenarioReportStructureService {
isError.set(isError.longValue() + 1); isError.set(isError.longValue() + 1);
} }
} }
} else if (StringUtils.isNotBlank(step.getType()) && step.getType().equals("MsUiCommand")) {
isError.set(isError.longValue() + 1);
} }
} }
} }
@ -203,7 +234,7 @@ public class ApiScenarioReportStructureService {
private void calculate(List<StepTreeDTO> dtoList, AtomicLong totalTime) { private void calculate(List<StepTreeDTO> dtoList, AtomicLong totalTime) {
for (StepTreeDTO step : dtoList) { for (StepTreeDTO step : dtoList) {
if (!StringUtils.equals(step.getType(), "scenario") && step.getValue() != null) { if (!StringUtils.equalsAny(step.getType(), "scenario", "UiScenario") && step.getValue() != null) {
if (step.getValue().getStartTime() == 0 || step.getValue().getEndTime() == 0) { if (step.getValue().getStartTime() == 0 || step.getValue().getEndTime() == 0) {
totalTime.set(totalTime.longValue() + 0); totalTime.set(totalTime.longValue() + 0);
} else if (step.getValue().getStartTime() > step.getValue().getEndTime() && step.getValue().getResponseResult() != null) { } else if (step.getValue().getStartTime() > step.getValue().getEndTime() && step.getValue().getResponseResult() != null) {

View File

@ -5,6 +5,7 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper; import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
import io.metersphere.base.mapper.ApiScenarioMapper; import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.commons.constants.APITestStatus; import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.base.mapper.UiScenarioMapper;
import io.metersphere.commons.constants.ApiRunMode; import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.ReportTriggerMode; import io.metersphere.commons.constants.ReportTriggerMode;
@ -46,6 +47,8 @@ public class TestResultService {
@Resource @Resource
private ApiScenarioMapper apiScenarioMapper; private ApiScenarioMapper apiScenarioMapper;
@Resource @Resource
private UiScenarioMapper uiScenarioMapper;
@Resource
private TestPlanApiCaseService testPlanApiCaseService; private TestPlanApiCaseService testPlanApiCaseService;
@Resource @Resource
private TestPlanTestCaseService testPlanTestCaseService; private TestPlanTestCaseService testPlanTestCaseService;
@ -75,6 +78,8 @@ public class TestResultService {
apiDefinitionExecResultService.saveApiResult(requestResults, dto); apiDefinitionExecResultService.saveApiResult(requestResults, dto);
} else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) { } else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
apiScenarioReportService.saveResult(requestResults, dto); apiScenarioReportService.saveResult(requestResults, dto);
} else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.UI_SCENARIO.name(), ApiRunMode.UI_SCENARIO_PLAN.name(), ApiRunMode.UI_JENKINS_SCENARIO_PLAN.name(), ApiRunMode.UI_SCHEDULE_SCENARIO.name(), ApiRunMode.UI_SCHEDULE_SCENARIO_PLAN.name())) {
apiScenarioReportService.saveUiResult(requestResults, dto);
} }
updateTestCaseStates(requestResults, dto.getRunMode()); updateTestCaseStates(requestResults, dto.getRunMode());
} }
@ -109,20 +114,30 @@ public class TestResultService {
} }
public void testEnded(ResultDTO dto) { public void testEnded(ResultDTO dto) {
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) { if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())
|| dto.getRunMode().startsWith("UI")) {
ApiScenarioReport scenarioReport = apiScenarioReportService.testEnded(dto); ApiScenarioReport scenarioReport = apiScenarioReportService.testEnded(dto);
if (scenarioReport != null) { if (scenarioReport != null) {
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
String environment = ""; String environment = "";
//执行人 //执行人
String userName = ""; String userName = "";
//负责人 //负责人
String principal = ""; String principal = "";
if (dto.getRunMode().startsWith("UI")) {
UiScenarioWithBLOBs uiScenario = uiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
if (uiScenario != null) {
userName = apiAutomationService.getUser(uiScenario.getUserId());
principal = apiAutomationService.getUser(uiScenario.getPrincipal());
}
} else {
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
if (apiScenario != null) { if (apiScenario != null) {
environment = apiScenarioReportService.getEnvironment(apiScenario); environment = apiScenarioReportService.getEnvironment(apiScenario);
userName = apiAutomationService.getUser(apiScenario.getUserId()); userName = apiAutomationService.getUser(apiScenario.getUserId());
principal = apiAutomationService.getUser(apiScenario.getPrincipal()); principal = apiAutomationService.getUser(apiScenario.getPrincipal());
} }
}
//报告内容 //报告内容
ApiTestReportVariable reportTask = new ApiTestReportVariable(); ApiTestReportVariable reportTask = new ApiTestReportVariable();
reportTask.setStatus(scenarioReport.getStatus()); reportTask.setStatus(scenarioReport.getStatus());

View File

@ -0,0 +1,11 @@
package io.metersphere.base.domain;
import lombok.Data;
/**
* 统一对模块的操作
*/
@Data
public class ModuleNode extends TestCaseNode {
private Integer caseNum;
}

View File

@ -0,0 +1,39 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class UiElement implements Serializable {
private String id;
private Integer num;
private String moduleId;
private String projectId;
private String name;
private String locationType;
private String location;
private String createUser;
private String versionId;
private String refId;
private Long order;
private Boolean latest;
private String description;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class UiScenario implements Serializable {
private String id;
private String projectId;
private String tags;
private String userId;
private String moduleId;
private String modulePath;
private String name;
private String level;
private String status;
private String principal;
private Integer stepTotal;
private String schedule;
private Long createTime;
private Long updateTime;
private String passRate;
private String lastResult;
private String reportId;
private Integer num;
private String originalState;
private String customNum;
private String createUser;
private Integer version;
private Long deleteTime;
private String deleteUserId;
private Integer executeTimes;
private Long order;
private String environmentType;
private String environmentGroupId;
private String versionId;
private String refId;
private Boolean latest;
private static final long serialVersionUID = 1L;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class UiScenarioModule implements Serializable {
private String id;
private String projectId;
private String name;
private String parentId;
private Integer level;
private Long createTime;
private Long updateTime;
private Double pos;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,790 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class UiScenarioModuleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UiScenarioModuleExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> 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 Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andParentIdIsNull() {
addCriterion("parent_id is null");
return (Criteria) this;
}
public Criteria andParentIdIsNotNull() {
addCriterion("parent_id is not null");
return (Criteria) this;
}
public Criteria andParentIdEqualTo(String value) {
addCriterion("parent_id =", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotEqualTo(String value) {
addCriterion("parent_id <>", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThan(String value) {
addCriterion("parent_id >", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThanOrEqualTo(String value) {
addCriterion("parent_id >=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThan(String value) {
addCriterion("parent_id <", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThanOrEqualTo(String value) {
addCriterion("parent_id <=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLike(String value) {
addCriterion("parent_id like", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotLike(String value) {
addCriterion("parent_id not like", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdIn(List<String> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<String> values) {
addCriterion("parent_id not in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdBetween(String value1, String value2) {
addCriterion("parent_id between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotBetween(String value1, String value2) {
addCriterion("parent_id not between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andLevelIsNull() {
addCriterion("`level` is null");
return (Criteria) this;
}
public Criteria andLevelIsNotNull() {
addCriterion("`level` is not null");
return (Criteria) this;
}
public Criteria andLevelEqualTo(Integer value) {
addCriterion("`level` =", value, "level");
return (Criteria) this;
}
public Criteria andLevelNotEqualTo(Integer value) {
addCriterion("`level` <>", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThan(Integer value) {
addCriterion("`level` >", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThanOrEqualTo(Integer value) {
addCriterion("`level` >=", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThan(Integer value) {
addCriterion("`level` <", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThanOrEqualTo(Integer value) {
addCriterion("`level` <=", value, "level");
return (Criteria) this;
}
public Criteria andLevelIn(List<Integer> values) {
addCriterion("`level` in", values, "level");
return (Criteria) this;
}
public Criteria andLevelNotIn(List<Integer> values) {
addCriterion("`level` not in", values, "level");
return (Criteria) this;
}
public Criteria andLevelBetween(Integer value1, Integer value2) {
addCriterion("`level` between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andLevelNotBetween(Integer value1, Integer value2) {
addCriterion("`level` not between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andPosIsNull() {
addCriterion("pos is null");
return (Criteria) this;
}
public Criteria andPosIsNotNull() {
addCriterion("pos is not null");
return (Criteria) this;
}
public Criteria andPosEqualTo(Double value) {
addCriterion("pos =", value, "pos");
return (Criteria) this;
}
public Criteria andPosNotEqualTo(Double value) {
addCriterion("pos <>", value, "pos");
return (Criteria) this;
}
public Criteria andPosGreaterThan(Double value) {
addCriterion("pos >", value, "pos");
return (Criteria) this;
}
public Criteria andPosGreaterThanOrEqualTo(Double value) {
addCriterion("pos >=", value, "pos");
return (Criteria) this;
}
public Criteria andPosLessThan(Double value) {
addCriterion("pos <", value, "pos");
return (Criteria) this;
}
public Criteria andPosLessThanOrEqualTo(Double value) {
addCriterion("pos <=", value, "pos");
return (Criteria) this;
}
public Criteria andPosIn(List<Double> values) {
addCriterion("pos in", values, "pos");
return (Criteria) this;
}
public Criteria andPosNotIn(List<Double> values) {
addCriterion("pos not in", values, "pos");
return (Criteria) this;
}
public Criteria andPosBetween(Double value1, Double value2) {
addCriterion("pos between", value1, value2, "pos");
return (Criteria) this;
}
public Criteria andPosNotBetween(Double value1, Double value2) {
addCriterion("pos not between", value1, value2, "pos");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
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);
}
}
}

View File

@ -0,0 +1,23 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class UiScenarioReference implements Serializable {
private String id;
private String uiScenarioId;
private Long createTime;
private String createUserId;
private String referenceId;
private String referenceType;
private String dataType;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,680 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class UiScenarioReferenceExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UiScenarioReferenceExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> 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 Criteria andUiScenarioIdIsNull() {
addCriterion("ui_scenario_id is null");
return (Criteria) this;
}
public Criteria andUiScenarioIdIsNotNull() {
addCriterion("ui_scenario_id is not null");
return (Criteria) this;
}
public Criteria andUiScenarioIdEqualTo(String value) {
addCriterion("ui_scenario_id =", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdNotEqualTo(String value) {
addCriterion("ui_scenario_id <>", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdGreaterThan(String value) {
addCriterion("ui_scenario_id >", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdGreaterThanOrEqualTo(String value) {
addCriterion("ui_scenario_id >=", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdLessThan(String value) {
addCriterion("ui_scenario_id <", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdLessThanOrEqualTo(String value) {
addCriterion("ui_scenario_id <=", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdLike(String value) {
addCriterion("ui_scenario_id like", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdNotLike(String value) {
addCriterion("ui_scenario_id not like", value, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdIn(List<String> values) {
addCriterion("ui_scenario_id in", values, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdNotIn(List<String> values) {
addCriterion("ui_scenario_id not in", values, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdBetween(String value1, String value2) {
addCriterion("ui_scenario_id between", value1, value2, "uiScenarioId");
return (Criteria) this;
}
public Criteria andUiScenarioIdNotBetween(String value1, String value2) {
addCriterion("ui_scenario_id not between", value1, value2, "uiScenarioId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateUserIdIsNull() {
addCriterion("create_user_id is null");
return (Criteria) this;
}
public Criteria andCreateUserIdIsNotNull() {
addCriterion("create_user_id is not null");
return (Criteria) this;
}
public Criteria andCreateUserIdEqualTo(String value) {
addCriterion("create_user_id =", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotEqualTo(String value) {
addCriterion("create_user_id <>", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdGreaterThan(String value) {
addCriterion("create_user_id >", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdGreaterThanOrEqualTo(String value) {
addCriterion("create_user_id >=", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLessThan(String value) {
addCriterion("create_user_id <", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLessThanOrEqualTo(String value) {
addCriterion("create_user_id <=", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdLike(String value) {
addCriterion("create_user_id like", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotLike(String value) {
addCriterion("create_user_id not like", value, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdIn(List<String> values) {
addCriterion("create_user_id in", values, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotIn(List<String> values) {
addCriterion("create_user_id not in", values, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdBetween(String value1, String value2) {
addCriterion("create_user_id between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andCreateUserIdNotBetween(String value1, String value2) {
addCriterion("create_user_id not between", value1, value2, "createUserId");
return (Criteria) this;
}
public Criteria andReferenceIdIsNull() {
addCriterion("reference_id is null");
return (Criteria) this;
}
public Criteria andReferenceIdIsNotNull() {
addCriterion("reference_id is not null");
return (Criteria) this;
}
public Criteria andReferenceIdEqualTo(String value) {
addCriterion("reference_id =", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdNotEqualTo(String value) {
addCriterion("reference_id <>", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdGreaterThan(String value) {
addCriterion("reference_id >", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdGreaterThanOrEqualTo(String value) {
addCriterion("reference_id >=", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdLessThan(String value) {
addCriterion("reference_id <", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdLessThanOrEqualTo(String value) {
addCriterion("reference_id <=", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdLike(String value) {
addCriterion("reference_id like", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdNotLike(String value) {
addCriterion("reference_id not like", value, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdIn(List<String> values) {
addCriterion("reference_id in", values, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdNotIn(List<String> values) {
addCriterion("reference_id not in", values, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdBetween(String value1, String value2) {
addCriterion("reference_id between", value1, value2, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceIdNotBetween(String value1, String value2) {
addCriterion("reference_id not between", value1, value2, "referenceId");
return (Criteria) this;
}
public Criteria andReferenceTypeIsNull() {
addCriterion("reference_type is null");
return (Criteria) this;
}
public Criteria andReferenceTypeIsNotNull() {
addCriterion("reference_type is not null");
return (Criteria) this;
}
public Criteria andReferenceTypeEqualTo(String value) {
addCriterion("reference_type =", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeNotEqualTo(String value) {
addCriterion("reference_type <>", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeGreaterThan(String value) {
addCriterion("reference_type >", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeGreaterThanOrEqualTo(String value) {
addCriterion("reference_type >=", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeLessThan(String value) {
addCriterion("reference_type <", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeLessThanOrEqualTo(String value) {
addCriterion("reference_type <=", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeLike(String value) {
addCriterion("reference_type like", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeNotLike(String value) {
addCriterion("reference_type not like", value, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeIn(List<String> values) {
addCriterion("reference_type in", values, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeNotIn(List<String> values) {
addCriterion("reference_type not in", values, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeBetween(String value1, String value2) {
addCriterion("reference_type between", value1, value2, "referenceType");
return (Criteria) this;
}
public Criteria andReferenceTypeNotBetween(String value1, String value2) {
addCriterion("reference_type not between", value1, value2, "referenceType");
return (Criteria) this;
}
public Criteria andDataTypeIsNull() {
addCriterion("data_type is null");
return (Criteria) this;
}
public Criteria andDataTypeIsNotNull() {
addCriterion("data_type is not null");
return (Criteria) this;
}
public Criteria andDataTypeEqualTo(String value) {
addCriterion("data_type =", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeNotEqualTo(String value) {
addCriterion("data_type <>", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeGreaterThan(String value) {
addCriterion("data_type >", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeGreaterThanOrEqualTo(String value) {
addCriterion("data_type >=", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeLessThan(String value) {
addCriterion("data_type <", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeLessThanOrEqualTo(String value) {
addCriterion("data_type <=", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeLike(String value) {
addCriterion("data_type like", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeNotLike(String value) {
addCriterion("data_type not like", value, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeIn(List<String> values) {
addCriterion("data_type in", values, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeNotIn(List<String> values) {
addCriterion("data_type not in", values, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeBetween(String value1, String value2) {
addCriterion("data_type between", value1, value2, "dataType");
return (Criteria) this;
}
public Criteria andDataTypeNotBetween(String value1, String value2) {
addCriterion("data_type not between", value1, value2, "dataType");
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);
}
}
}

View File

@ -0,0 +1,21 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class UiScenarioWithBLOBs extends UiScenario implements Serializable {
private String scenarioDefinition;
private String description;
private String useUrl;
private String environmentJson;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.UiElement;
import io.metersphere.base.domain.UiElementExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UiElementMapper {
long countByExample(UiElementExample example);
int deleteByExample(UiElementExample example);
int deleteByPrimaryKey(String id);
int insert(UiElement record);
int insertSelective(UiElement record);
List<UiElement> selectByExample(UiElementExample example);
UiElement selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") UiElement record, @Param("example") UiElementExample example);
int updateByExample(@Param("record") UiElement record, @Param("example") UiElementExample example);
int updateByPrimaryKeySelective(UiElement record);
int updateByPrimaryKey(UiElement record);
}

View File

@ -0,0 +1,368 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.UiElementMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UiElement">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="location_type" jdbcType="VARCHAR" property="locationType" />
<result column="location" jdbcType="VARCHAR" property="location" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="latest" jdbcType="BIT" property="latest" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, num, module_id, project_id, `name`, location_type, `location`, create_user, version_id,
ref_id, `order`, latest, description, create_time, update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UiElementExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ui_element
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ui_element
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from ui_element
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UiElementExample">
delete from ui_element
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.UiElement">
insert into ui_element (id, num, module_id,
project_id, `name`, location_type,
`location`, create_user, version_id,
ref_id, `order`, latest, description,
create_time, update_time)
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, #{moduleId,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{locationType,jdbcType=VARCHAR},
#{location,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR},
#{refId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{latest,jdbcType=BIT}, #{description,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UiElement">
insert into ui_element
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="num != null">
num,
</if>
<if test="moduleId != null">
module_id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="locationType != null">
location_type,
</if>
<if test="location != null">
`location`,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="order != null">
`order`,
</if>
<if test="latest != null">
latest,
</if>
<if test="description != null">
description,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="num != null">
#{num,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="locationType != null">
#{locationType,jdbcType=VARCHAR},
</if>
<if test="location != null">
#{location,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="latest != null">
#{latest,jdbcType=BIT},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UiElementExample" resultType="java.lang.Long">
select count(*) from ui_element
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ui_element
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.num != null">
num = #{record.num,jdbcType=INTEGER},
</if>
<if test="record.moduleId != null">
module_id = #{record.moduleId,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.locationType != null">
location_type = #{record.locationType,jdbcType=VARCHAR},
</if>
<if test="record.location != null">
`location` = #{record.location,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.refId != null">
ref_id = #{record.refId,jdbcType=VARCHAR},
</if>
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.latest != null">
latest = #{record.latest,jdbcType=BIT},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ui_element
set id = #{record.id,jdbcType=VARCHAR},
num = #{record.num,jdbcType=INTEGER},
module_id = #{record.moduleId,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
location_type = #{record.locationType,jdbcType=VARCHAR},
`location` = #{record.location,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
latest = #{record.latest,jdbcType=BIT},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UiElement">
update ui_element
<set>
<if test="num != null">
num = #{num,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="locationType != null">
location_type = #{locationType,jdbcType=VARCHAR},
</if>
<if test="location != null">
`location` = #{location,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
ref_id = #{refId,jdbcType=VARCHAR},
</if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="latest != null">
latest = #{latest,jdbcType=BIT},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UiElement">
update ui_element
set num = #{num,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
location_type = #{locationType,jdbcType=VARCHAR},
`location` = #{location,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
latest = #{latest,jdbcType=BIT},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,37 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.UiScenario;
import io.metersphere.base.domain.UiScenarioExample;
import io.metersphere.base.domain.UiScenarioWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UiScenarioMapper {
long countByExample(UiScenarioExample example);
int deleteByExample(UiScenarioExample example);
int deleteByPrimaryKey(String id);
int insert(UiScenarioWithBLOBs record);
int insertSelective(UiScenarioWithBLOBs record);
List<UiScenarioWithBLOBs> selectByExampleWithBLOBs(UiScenarioExample example);
List<UiScenario> selectByExample(UiScenarioExample example);
UiScenarioWithBLOBs selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") UiScenarioWithBLOBs record, @Param("example") UiScenarioExample example);
int updateByExampleWithBLOBs(@Param("record") UiScenarioWithBLOBs record, @Param("example") UiScenarioExample example);
int updateByExample(@Param("record") UiScenario record, @Param("example") UiScenarioExample example);
int updateByPrimaryKeySelective(UiScenarioWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(UiScenarioWithBLOBs record);
int updateByPrimaryKey(UiScenario record);
}

View File

@ -0,0 +1,779 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.UiScenarioMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UiScenario">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
<result column="module_path" jdbcType="VARCHAR" property="modulePath" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="level" jdbcType="VARCHAR" property="level" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="principal" jdbcType="VARCHAR" property="principal" />
<result column="step_total" jdbcType="INTEGER" property="stepTotal" />
<result column="schedule" jdbcType="VARCHAR" property="schedule" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="pass_rate" jdbcType="VARCHAR" property="passRate" />
<result column="last_result" jdbcType="VARCHAR" property="lastResult" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="original_state" jdbcType="VARCHAR" property="originalState" />
<result column="custom_num" jdbcType="VARCHAR" property="customNum" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="version" jdbcType="INTEGER" property="version" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
<result column="execute_times" jdbcType="INTEGER" property="executeTimes" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="environment_type" jdbcType="VARCHAR" property="environmentType" />
<result column="environment_group_id" jdbcType="VARCHAR" property="environmentGroupId" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
<result column="latest" jdbcType="BIT" property="latest" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.UiScenarioWithBLOBs">
<result column="scenario_definition" jdbcType="LONGVARCHAR" property="scenarioDefinition" />
<result column="description" jdbcType="LONGVARCHAR" property="description" />
<result column="use_url" jdbcType="LONGVARCHAR" property="useUrl" />
<result column="environment_json" jdbcType="LONGVARCHAR" property="environmentJson" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, tags, user_id, module_id, module_path, `name`, `level`, `status`,
principal, step_total, schedule, create_time, update_time, pass_rate, last_result,
report_id, num, original_state, custom_num, create_user, version, delete_time, delete_user_id,
execute_times, `order`, environment_type, environment_group_id, version_id, ref_id,
latest
</sql>
<sql id="Blob_Column_List">
scenario_definition, description, use_url, environment_json
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.UiScenarioExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from ui_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UiScenarioExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ui_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from ui_scenario
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from ui_scenario
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UiScenarioExample">
delete from ui_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.UiScenarioWithBLOBs">
insert into ui_scenario (id, project_id, tags,
user_id, module_id, module_path,
`name`, `level`, `status`,
principal, step_total, schedule,
create_time, update_time, pass_rate,
last_result, report_id, num,
original_state, custom_num, create_user,
version, delete_time, delete_user_id,
execute_times, `order`, environment_type,
environment_group_id, version_id, ref_id,
latest, scenario_definition, description,
use_url, environment_json)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{schedule,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{passRate,jdbcType=VARCHAR},
#{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER},
#{originalState,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{version,jdbcType=INTEGER}, #{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR},
#{executeTimes,jdbcType=INTEGER}, #{order,jdbcType=BIGINT}, #{environmentType,jdbcType=VARCHAR},
#{environmentGroupId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
#{latest,jdbcType=BIT}, #{scenarioDefinition,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR},
#{useUrl,jdbcType=LONGVARCHAR}, #{environmentJson,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UiScenarioWithBLOBs">
insert into ui_scenario
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="tags != null">
tags,
</if>
<if test="userId != null">
user_id,
</if>
<if test="moduleId != null">
module_id,
</if>
<if test="modulePath != null">
module_path,
</if>
<if test="name != null">
`name`,
</if>
<if test="level != null">
`level`,
</if>
<if test="status != null">
`status`,
</if>
<if test="principal != null">
principal,
</if>
<if test="stepTotal != null">
step_total,
</if>
<if test="schedule != null">
schedule,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="passRate != null">
pass_rate,
</if>
<if test="lastResult != null">
last_result,
</if>
<if test="reportId != null">
report_id,
</if>
<if test="num != null">
num,
</if>
<if test="originalState != null">
original_state,
</if>
<if test="customNum != null">
custom_num,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="version != null">
version,
</if>
<if test="deleteTime != null">
delete_time,
</if>
<if test="deleteUserId != null">
delete_user_id,
</if>
<if test="executeTimes != null">
execute_times,
</if>
<if test="order != null">
`order`,
</if>
<if test="environmentType != null">
environment_type,
</if>
<if test="environmentGroupId != null">
environment_group_id,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="latest != null">
latest,
</if>
<if test="scenarioDefinition != null">
scenario_definition,
</if>
<if test="description != null">
description,
</if>
<if test="useUrl != null">
use_url,
</if>
<if test="environmentJson != null">
environment_json,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
#{modulePath,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="principal != null">
#{principal,jdbcType=VARCHAR},
</if>
<if test="stepTotal != null">
#{stepTotal,jdbcType=INTEGER},
</if>
<if test="schedule != null">
#{schedule,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="passRate != null">
#{passRate,jdbcType=VARCHAR},
</if>
<if test="lastResult != null">
#{lastResult,jdbcType=VARCHAR},
</if>
<if test="reportId != null">
#{reportId,jdbcType=VARCHAR},
</if>
<if test="num != null">
#{num,jdbcType=INTEGER},
</if>
<if test="originalState != null">
#{originalState,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
#{customNum,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
<if test="deleteTime != null">
#{deleteTime,jdbcType=BIGINT},
</if>
<if test="deleteUserId != null">
#{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="executeTimes != null">
#{executeTimes,jdbcType=INTEGER},
</if>
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="environmentType != null">
#{environmentType,jdbcType=VARCHAR},
</if>
<if test="environmentGroupId != null">
#{environmentGroupId,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="latest != null">
#{latest,jdbcType=BIT},
</if>
<if test="scenarioDefinition != null">
#{scenarioDefinition,jdbcType=LONGVARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
<if test="useUrl != null">
#{useUrl,jdbcType=LONGVARCHAR},
</if>
<if test="environmentJson != null">
#{environmentJson,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UiScenarioExample" resultType="java.lang.Long">
select count(*) from ui_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ui_scenario
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.moduleId != null">
module_id = #{record.moduleId,jdbcType=VARCHAR},
</if>
<if test="record.modulePath != null">
module_path = #{record.modulePath,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
`level` = #{record.level,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.principal != null">
principal = #{record.principal,jdbcType=VARCHAR},
</if>
<if test="record.stepTotal != null">
step_total = #{record.stepTotal,jdbcType=INTEGER},
</if>
<if test="record.schedule != null">
schedule = #{record.schedule,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.passRate != null">
pass_rate = #{record.passRate,jdbcType=VARCHAR},
</if>
<if test="record.lastResult != null">
last_result = #{record.lastResult,jdbcType=VARCHAR},
</if>
<if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR},
</if>
<if test="record.num != null">
num = #{record.num,jdbcType=INTEGER},
</if>
<if test="record.originalState != null">
original_state = #{record.originalState,jdbcType=VARCHAR},
</if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=INTEGER},
</if>
<if test="record.deleteTime != null">
delete_time = #{record.deleteTime,jdbcType=BIGINT},
</if>
<if test="record.deleteUserId != null">
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
</if>
<if test="record.executeTimes != null">
execute_times = #{record.executeTimes,jdbcType=INTEGER},
</if>
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.environmentType != null">
environment_type = #{record.environmentType,jdbcType=VARCHAR},
</if>
<if test="record.environmentGroupId != null">
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.refId != null">
ref_id = #{record.refId,jdbcType=VARCHAR},
</if>
<if test="record.latest != null">
latest = #{record.latest,jdbcType=BIT},
</if>
<if test="record.scenarioDefinition != null">
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
<if test="record.useUrl != null">
use_url = #{record.useUrl,jdbcType=LONGVARCHAR},
</if>
<if test="record.environmentJson != null">
environment_json = #{record.environmentJson,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update ui_scenario
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
step_total = #{record.stepTotal,jdbcType=INTEGER},
schedule = #{record.schedule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
num = #{record.num,jdbcType=INTEGER},
original_state = #{record.originalState,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
version = #{record.version,jdbcType=INTEGER},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
execute_times = #{record.executeTimes,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT},
environment_type = #{record.environmentType,jdbcType=VARCHAR},
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
latest = #{record.latest,jdbcType=BIT},
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
use_url = #{record.useUrl,jdbcType=LONGVARCHAR},
environment_json = #{record.environmentJson,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ui_scenario
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
step_total = #{record.stepTotal,jdbcType=INTEGER},
schedule = #{record.schedule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
num = #{record.num,jdbcType=INTEGER},
original_state = #{record.originalState,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
version = #{record.version,jdbcType=INTEGER},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
execute_times = #{record.executeTimes,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT},
environment_type = #{record.environmentType,jdbcType=VARCHAR},
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
latest = #{record.latest,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UiScenarioWithBLOBs">
update ui_scenario
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="level != null">
`level` = #{level,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="principal != null">
principal = #{principal,jdbcType=VARCHAR},
</if>
<if test="stepTotal != null">
step_total = #{stepTotal,jdbcType=INTEGER},
</if>
<if test="schedule != null">
schedule = #{schedule,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="passRate != null">
pass_rate = #{passRate,jdbcType=VARCHAR},
</if>
<if test="lastResult != null">
last_result = #{lastResult,jdbcType=VARCHAR},
</if>
<if test="reportId != null">
report_id = #{reportId,jdbcType=VARCHAR},
</if>
<if test="num != null">
num = #{num,jdbcType=INTEGER},
</if>
<if test="originalState != null">
original_state = #{originalState,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
<if test="deleteTime != null">
delete_time = #{deleteTime,jdbcType=BIGINT},
</if>
<if test="deleteUserId != null">
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="executeTimes != null">
execute_times = #{executeTimes,jdbcType=INTEGER},
</if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="environmentType != null">
environment_type = #{environmentType,jdbcType=VARCHAR},
</if>
<if test="environmentGroupId != null">
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
ref_id = #{refId,jdbcType=VARCHAR},
</if>
<if test="latest != null">
latest = #{latest,jdbcType=BIT},
</if>
<if test="scenarioDefinition != null">
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
<if test="useUrl != null">
use_url = #{useUrl,jdbcType=LONGVARCHAR},
</if>
<if test="environmentJson != null">
environment_json = #{environmentJson,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.UiScenarioWithBLOBs">
update ui_scenario
set project_id = #{projectId,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`level` = #{level,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
step_total = #{stepTotal,jdbcType=INTEGER},
schedule = #{schedule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER},
original_state = #{originalState,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
version = #{version,jdbcType=INTEGER},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
execute_times = #{executeTimes,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT},
environment_type = #{environmentType,jdbcType=VARCHAR},
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
latest = #{latest,jdbcType=BIT},
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
use_url = #{useUrl,jdbcType=LONGVARCHAR},
environment_json = #{environmentJson,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UiScenario">
update ui_scenario
set project_id = #{projectId,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`level` = #{level,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
step_total = #{stepTotal,jdbcType=INTEGER},
schedule = #{schedule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER},
original_state = #{originalState,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
version = #{version,jdbcType=INTEGER},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
execute_times = #{executeTimes,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT},
environment_type = #{environmentType,jdbcType=VARCHAR},
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
latest = #{latest,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.UiScenarioModule;
import io.metersphere.base.domain.UiScenarioModuleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UiScenarioModuleMapper {
long countByExample(UiScenarioModuleExample example);
int deleteByExample(UiScenarioModuleExample example);
int deleteByPrimaryKey(String id);
int insert(UiScenarioModule record);
int insertSelective(UiScenarioModule record);
List<UiScenarioModule> selectByExample(UiScenarioModuleExample example);
UiScenarioModule selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") UiScenarioModule record, @Param("example") UiScenarioModuleExample example);
int updateByExample(@Param("record") UiScenarioModule record, @Param("example") UiScenarioModuleExample example);
int updateByPrimaryKeySelective(UiScenarioModule record);
int updateByPrimaryKey(UiScenarioModule record);
}

View File

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.UiScenarioModuleMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UiScenarioModule">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="pos" jdbcType="DOUBLE" property="pos" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, parent_id, `level`, create_time, update_time, pos, create_user
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UiScenarioModuleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ui_scenario_module
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ui_scenario_module
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from ui_scenario_module
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UiScenarioModuleExample">
delete from ui_scenario_module
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.UiScenarioModule">
insert into ui_scenario_module (id, project_id, `name`,
parent_id, `level`, create_time,
update_time, pos, create_user
)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{parentId,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{pos,jdbcType=DOUBLE}, #{createUser,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UiScenarioModule">
insert into ui_scenario_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="level != null">
`level`,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="pos != null">
pos,
</if>
<if test="createUser != null">
create_user,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="pos != null">
#{pos,jdbcType=DOUBLE},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UiScenarioModuleExample" resultType="java.lang.Long">
select count(*) from ui_scenario_module
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ui_scenario_module
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
`level` = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.pos != null">
pos = #{record.pos,jdbcType=DOUBLE},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ui_scenario_module
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
parent_id = #{record.parentId,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pos = #{record.pos,jdbcType=DOUBLE},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UiScenarioModule">
update ui_scenario_module
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="level != null">
`level` = #{level,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="pos != null">
pos = #{pos,jdbcType=DOUBLE},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UiScenarioModule">
update ui_scenario_module
set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
parent_id = #{parentId,jdbcType=VARCHAR},
`level` = #{level,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pos = #{pos,jdbcType=DOUBLE},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.UiScenarioReference;
import io.metersphere.base.domain.UiScenarioReferenceExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UiScenarioReferenceMapper {
long countByExample(UiScenarioReferenceExample example);
int deleteByExample(UiScenarioReferenceExample example);
int deleteByPrimaryKey(String id);
int insert(UiScenarioReference record);
int insertSelective(UiScenarioReference record);
List<UiScenarioReference> selectByExample(UiScenarioReferenceExample example);
UiScenarioReference selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") UiScenarioReference record, @Param("example") UiScenarioReferenceExample example);
int updateByExample(@Param("record") UiScenarioReference record, @Param("example") UiScenarioReferenceExample example);
int updateByPrimaryKeySelective(UiScenarioReference record);
int updateByPrimaryKey(UiScenarioReference record);
}

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.UiScenarioReferenceMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UiScenarioReference">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="ui_scenario_id" jdbcType="VARCHAR" property="uiScenarioId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
<result column="reference_id" jdbcType="VARCHAR" property="referenceId" />
<result column="reference_type" jdbcType="VARCHAR" property="referenceType" />
<result column="data_type" jdbcType="VARCHAR" property="dataType" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, ui_scenario_id, create_time, create_user_id, reference_id, reference_type, data_type
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UiScenarioReferenceExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ui_scenario_reference
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ui_scenario_reference
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from ui_scenario_reference
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UiScenarioReferenceExample">
delete from ui_scenario_reference
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.UiScenarioReference">
insert into ui_scenario_reference (id, ui_scenario_id, create_time,
create_user_id, reference_id, reference_type,
data_type)
values (#{id,jdbcType=VARCHAR}, #{uiScenarioId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createUserId,jdbcType=VARCHAR}, #{referenceId,jdbcType=VARCHAR}, #{referenceType,jdbcType=VARCHAR},
#{dataType,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UiScenarioReference">
insert into ui_scenario_reference
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="uiScenarioId != null">
ui_scenario_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="referenceId != null">
reference_id,
</if>
<if test="referenceType != null">
reference_type,
</if>
<if test="dataType != null">
data_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="uiScenarioId != null">
#{uiScenarioId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUserId != null">
#{createUserId,jdbcType=VARCHAR},
</if>
<if test="referenceId != null">
#{referenceId,jdbcType=VARCHAR},
</if>
<if test="referenceType != null">
#{referenceType,jdbcType=VARCHAR},
</if>
<if test="dataType != null">
#{dataType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UiScenarioReferenceExample" resultType="java.lang.Long">
select count(*) from ui_scenario_reference
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ui_scenario_reference
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.uiScenarioId != null">
ui_scenario_id = #{record.uiScenarioId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
</if>
<if test="record.referenceId != null">
reference_id = #{record.referenceId,jdbcType=VARCHAR},
</if>
<if test="record.referenceType != null">
reference_type = #{record.referenceType,jdbcType=VARCHAR},
</if>
<if test="record.dataType != null">
data_type = #{record.dataType,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ui_scenario_reference
set id = #{record.id,jdbcType=VARCHAR},
ui_scenario_id = #{record.uiScenarioId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
reference_id = #{record.referenceId,jdbcType=VARCHAR},
reference_type = #{record.referenceType,jdbcType=VARCHAR},
data_type = #{record.dataType,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UiScenarioReference">
update ui_scenario_reference
<set>
<if test="uiScenarioId != null">
ui_scenario_id = #{uiScenarioId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId,jdbcType=VARCHAR},
</if>
<if test="referenceId != null">
reference_id = #{referenceId,jdbcType=VARCHAR},
</if>
<if test="referenceType != null">
reference_type = #{referenceType,jdbcType=VARCHAR},
</if>
<if test="dataType != null">
data_type = #{dataType,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UiScenarioReference">
update ui_scenario_reference
set ui_scenario_id = #{uiScenarioId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user_id = #{createUserId,jdbcType=VARCHAR},
reference_id = #{referenceId,jdbcType=VARCHAR},
reference_type = #{referenceType,jdbcType=VARCHAR},
data_type = #{dataType,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -168,6 +168,7 @@
<if test="request.projectId != null"> <if test="request.projectId != null">
AND s_r.project_id = #{request.projectId} AND s_r.project_id = #{request.projectId}
</if> </if>
<if test="request.filters != null and request.filters.size() > 0"> <if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values"> <foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0"> <if test="values != null and values.size() > 0">

View File

@ -0,0 +1,34 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.ModuleNode;
import io.metersphere.base.domain.TestCaseNodeExample;
import io.metersphere.track.dto.ModuleNodeDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtModuleNodeMapper {
int insertSelective(@Param("tableName") String tableName, @Param("record") ModuleNode record);
List<ModuleNode> selectByExample(@Param("tableName") String tableName, @Param("example") TestCaseNodeExample example);
List<String> getNodeIdsByPid(@Param("tableName") String tableName, @Param("parentId") String parentId);
List<ModuleNodeDTO> getNodeTreeByProjectId(@Param("tableName") String tableName, @Param("projectId") String projectId);
int updateByPrimaryKeySelective(@Param("tableName") String tableName, @Param("record") ModuleNode record);
int deleteByExample(@Param("tableName") String tableName, @Param("example") TestCaseNodeExample example);
void insert(@Param("tableName") String tableName, @Param("record") ModuleNode record);
ModuleNodeDTO get(@Param("tableName") String tableName, @Param("id") String id);
void updatePos(@Param("tableName") String tableName, @Param("id") String id, @Param("pos") Double pos);
void updateByPrimaryKey(@Param("tableName") String tableName, @Param("record") ModuleNode record);
ModuleNode selectByPrimaryKey(@Param("tableName") String tableName, @Param("id") String id);
long countByExample(@Param("tableName") String tableName, @Param("example") TestCaseNodeExample example);
}

View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtModuleNodeMapper">
<insert id="insertSelective">
insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.id != null">
id,
</if>
<if test="record.projectId != null">
project_id,
</if>
<if test="record.name != null">
`name`,
</if>
<if test="record.parentId != null">
parent_id,
</if>
<if test="record.level != null">
`level`,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.pos != null">
pos,
</if>
<if test="record.createUser != null">
create_user,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.id != null">
#{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
#{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
#{record.name,jdbcType=VARCHAR},
</if>
<if test="record.parentId != null">
#{record.parentId,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
#{record.level,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
#{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
#{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.pos != null">
#{record.pos,jdbcType=DOUBLE},
</if>
<if test="record.createUser != null">
#{record.createUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="insert">
insert into ${tableName} (id, project_id, `name`,
parent_id, `level`, create_time,
update_time, pos, create_user
)
values (#{record.id,jdbcType=VARCHAR}, #{record.projectId,jdbcType=VARCHAR}, #{record.name,jdbcType=VARCHAR},
#{record.parentId,jdbcType=VARCHAR}, #{record.level,jdbcType=INTEGER}, #{record.createTime,jdbcType=BIGINT},
#{record.updateTime,jdbcType=BIGINT}, #{record.pos,jdbcType=DOUBLE}, #{record.createUser,jdbcType=VARCHAR}
)
</insert>
<update id="updateByPrimaryKeySelective">
update ${tableName}
<set>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
`level` = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.pos != null">
pos = #{record.pos,jdbcType=DOUBLE},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
</set>
where id = #{record.id,jdbcType=VARCHAR}
</update>
<update id="updatePos">
update ${tableName}
set pos = #{pos}
where id = #{id}
</update>
<update id="updateByPrimaryKey">
update ${tableName}
set project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
parent_id = #{record.parentId,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pos = #{record.pos,jdbcType=DOUBLE},
create_user = #{record.createUser,jdbcType=VARCHAR}
where id = #{record.id,jdbcType=VARCHAR}
</update>
<delete id="deleteByExample">
delete from ${tableName}
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<select id="selectByExample" resultType="io.metersphere.base.domain.ModuleNode">
select
<if test="example.distinct">
distinct
</if>
<include refid="io.metersphere.base.mapper.TestCaseNodeMapper.Base_Column_List" />
from ${tableName}
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="getNodeIdsByPid" resultType="java.lang.String">
select id
from ${tableName}
where parent_id = #{parentId}
</select>
<select id="getNodeTreeByProjectId" resultType="io.metersphere.track.dto.ModuleNodeDTO">
select
<include refid="io.metersphere.base.mapper.TestCaseNodeMapper.Base_Column_List"/>
from ${tableName}
where project_id = #{projectId}
order by pos asc
</select>
<select id="get" resultType="io.metersphere.track.dto.ModuleNodeDTO">
select
<include refid="io.metersphere.base.mapper.TestCaseNodeMapper.Base_Column_List"/>
from ${tableName}
where id = #{id}
</select>
<select id="selectByPrimaryKey" resultType="io.metersphere.base.domain.ModuleNode">
select
<include refid="io.metersphere.base.mapper.TestCaseNodeMapper.Base_Column_List" />
from ${tableName}
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="countByExample" resultType="java.lang.Long">
select count(*) from ${tableName}
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<sql id="Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
</mapper>

View File

@ -2,5 +2,6 @@ package io.metersphere.commons.constants;
public enum ApiRunMode { public enum ApiRunMode {
RUN, DEBUG, DEFINITION, TEST_CASE, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS_SCENARIO_PLAN, JENKINS_PERFORMANCE_TEST, JENKINS, RUN, DEBUG, DEFINITION, TEST_CASE, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS_SCENARIO_PLAN, JENKINS_PERFORMANCE_TEST, JENKINS,
SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST, MANUAL_PLAN SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST, MANUAL_PLAN,
UI_SCENARIO, UI_SCENARIO_PLAN, UI_SCHEDULE_SCENARIO_PLAN, UI_JENKINS_SCENARIO_PLAN, UI_SCHEDULE_SCENARIO
} }

View File

@ -4,5 +4,7 @@ public enum ReportTypeConstants {
SCENARIO_INTEGRATED, SCENARIO_INTEGRATED,
SCENARIO_INDEPENDENT, SCENARIO_INDEPENDENT,
API_INTEGRATED, API_INTEGRATED,
API_INDEPENDENT API_INDEPENDENT,
UI_INTEGRATED,
UI_INDEPENDENT
} }

View File

@ -25,6 +25,7 @@ import java.util.zip.ZipOutputStream;
public class FileUtils { public class FileUtils {
public static final String BODY_FILE_DIR = "/opt/metersphere/data/body"; public static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
public static final String MD_IMAGE_DIR = "/opt/metersphere/data/image/markdown"; public static final String MD_IMAGE_DIR = "/opt/metersphere/data/image/markdown";
public static final String UI_IMAGE_DIR = "/opt/metersphere/data/image/ui/screenshots";
public static byte[] listBytesToZip(Map<String, byte[]> mapReport) { public static byte[] listBytesToZip(Map<String, byte[]> mapReport) {
try { try {

View File

@ -1,6 +1,5 @@
package io.metersphere.commons.utils; package io.metersphere.commons.utils;
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
import io.metersphere.base.domain.Project; import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ProjectVersion; import io.metersphere.base.domain.ProjectVersion;
import io.metersphere.base.domain.User; import io.metersphere.base.domain.User;
@ -18,6 +17,7 @@ import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionUtils; import org.mybatis.spring.SqlSessionUtils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
import java.util.function.BiFunction; import java.util.function.BiFunction;
@ -235,6 +235,25 @@ public class ServiceUtils {
return (lastOrder == null ? 0 : lastOrder) + ServiceUtils.ORDER_STEP; return (lastOrder == null ? 0 : lastOrder) + ServiceUtils.ORDER_STEP;
} }
public static <T> int getNextNum(String projectId, Class<T> clazz, Function<String, T> getNextNumFunc) {
T data = getNextNumFunc.apply(projectId);
try {
Method getNum = clazz.getMethod("getNum");
if (data == null || getNum.invoke(data) == null) {
return 100001;
} else {
return Optional.ofNullable((Integer)getNum.invoke(data) + 1).orElse(100001);
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return 100001;
}
public static SqlSession getBatchSqlSession() { public static SqlSession getBatchSqlSession() {
SqlSessionFactory sqlSessionFactory = CommonBeanFactory.getBean(SqlSessionFactory.class); SqlSessionFactory sqlSessionFactory = CommonBeanFactory.getBean(SqlSessionFactory.class);
return sqlSessionFactory.openSession(ExecutorType.BATCH); return sqlSessionFactory.openSession(ExecutorType.BATCH);

View File

@ -16,6 +16,7 @@ public class ShiroUtils {
public static void loadBaseFilterChain(Map<String, String> filterChainDefinitionMap) { public static void loadBaseFilterChain(Map<String, String> filterChainDefinitionMap) {
filterChainDefinitionMap.put("/resource/md/get/**", "anon"); filterChainDefinitionMap.put("/resource/md/get/**", "anon");
filterChainDefinitionMap.put("/resource/ui/get/**", "anon");
filterChainDefinitionMap.put("/*.worker.js", "anon"); filterChainDefinitionMap.put("/*.worker.js", "anon");
filterChainDefinitionMap.put("/login", "anon"); filterChainDefinitionMap.put("/login", "anon");
filterChainDefinitionMap.put("/signin", "anon"); filterChainDefinitionMap.put("/signin", "anon");

View File

@ -25,6 +25,11 @@ public class ResourceController {
return resourceService.getMdImage(fileName); return resourceService.getMdImage(fileName);
} }
@GetMapping(value = "/ui/get")
public ResponseEntity<FileSystemResource> getUiFile(@RequestParam ("fileName") String fileName) {
return resourceService.getUiResultImage(fileName);
}
/** /**
* 兼容旧版本 * 兼容旧版本
* @param fileName * @param fileName

View File

@ -0,0 +1,584 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import com.google.common.util.concurrent.AtomicDouble;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.ExtModuleNodeMapper;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.exception.ExcelException;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.api.ModuleReference;
import io.metersphere.track.dto.EditModuleDateDTO;
import io.metersphere.track.dto.ModuleNodeDTO;
import io.metersphere.track.dto.TestCaseNodeDTO;
import io.metersphere.track.request.testcase.DragNodeRequest;
import io.metersphere.track.request.testcase.QueryNodeRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
public class BaseModuleService extends NodeTreeService<ModuleNodeDTO> {
private String tableName;
@Resource
ExtModuleNodeMapper extModuleNodeMapper;
@Resource
SqlSessionFactory sqlSessionFactory;
@Resource
ProjectMapper projectMapper;
public BaseModuleService() {
super(ModuleNodeDTO.class);
}
public BaseModuleService(String tableName) {
this();
this.tableName = tableName;
}
public String addNode(ModuleNode module) {
validateNode(module);
module.setCreateTime(System.currentTimeMillis());
module.setUpdateTime(System.currentTimeMillis());
if (StringUtils.isBlank(module.getId())) {
module.setId(UUID.randomUUID().toString());
}
module.setCreateUser(SessionUtils.getUserId());
double pos = getNextLevelPos(module.getProjectId(), module.getLevel(), module.getParentId());
module.setPos(pos);
extModuleNodeMapper.insertSelective(tableName, module);
return module.getId();
}
public List<String> getNodes(String nodeId) {
return extModuleNodeMapper.getNodeIdsByPid(tableName, nodeId);
}
public ModuleNode get(String id) {
return extModuleNodeMapper.selectByPrimaryKey(tableName, id);
}
private void validateNode(ModuleNode node) {
if (node.getLevel() > TestCaseConstants.MAX_NODE_DEPTH) {
throw new RuntimeException(Translator.get("test_case_node_level_tip")
+ TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level"));
}
checkTestCaseNodeExist(node);
}
private void checkTestCaseNodeExist(ModuleNode node) {
if (node.getName() != null) {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
if (extModuleNodeMapper.selectByExample(tableName, example).size() > 0) {
MSException.throwException(Translator.get("test_case_module_already_exists"));
}
}
}
public ModuleNode getDefaultNode(String projectId) {
TestCaseNodeExample example = new TestCaseNodeExample();
example.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo("未规划用例").andParentIdIsNull();
List<ModuleNode> list = extModuleNodeMapper.selectByExample(tableName, example);
if(CollectionUtils.isEmpty(list)){
ModuleNode record = new ModuleNode();
record.setId(UUID.randomUUID().toString());
record.setCreateUser(SessionUtils.getUserId());
record.setName("未规划用例");
record.setPos(1.0);
record.setLevel(1);
record.setCreateTime(System.currentTimeMillis());
record.setUpdateTime(System.currentTimeMillis());
record.setProjectId(projectId);
extModuleNodeMapper.insert(tableName, record);
record.setCaseNum(0);
return record;
}else {
return list.get(0);
}
}
public List<ModuleNodeDTO> getNodeTreeByProjectIdWithCount(String projectId, Function<QueryNodeRequest, List<Map<String,Object>>> getModuleCountFunc) {
// 判断当前项目下是否有默认模块没有添加默认模块
this.getDefaultNode(projectId);
List<ModuleNodeDTO> moduleNodes = extModuleNodeMapper.getNodeTreeByProjectId(tableName, projectId);
if (getModuleCountFunc != null) {
buildNodeCount(projectId, moduleNodes, getModuleCountFunc);
}
return getNodeTrees(moduleNodes);
}
public List<ModuleNodeDTO> getNodeTreeByProjectId(String projectId) {
return getNodeTreeByProjectIdWithCount(projectId, null);
}
private void buildNodeCount(String projectId, List<ModuleNodeDTO> moduleNodes, Function<QueryNodeRequest, List<Map<String,Object>>> getModuleCountFunc) {
QueryNodeRequest request = new QueryNodeRequest();
request.setProjectId(projectId);
//优化将for循环内的SQL抽出来只查一次
List<String> allModuleIdList = new ArrayList<>();
for (ModuleNodeDTO node : moduleNodes) {
List<String> moduleIds = new ArrayList<>();
moduleIds = nodeList(moduleNodes, node.getId(), moduleIds);
moduleIds.add(node.getId());
for (String moduleId : moduleIds) {
if(!allModuleIdList.contains(moduleId)){
allModuleIdList.add(moduleId);
}
}
}
request.setModuleIds(allModuleIdList);
List<Map<String,Object>> moduleCountList = getModuleCountFunc.apply(request);
// List<Map<String,Object>> moduleCountList = extTestCaseMapper.moduleCountByCollection(request);
Map<String,Integer> moduleCountMap = this.parseModuleCountList(moduleCountList);
moduleNodes.forEach(node -> {
List<String> moduleIds = new ArrayList<>();
moduleIds = nodeList(moduleNodes, node.getId(), moduleIds);
moduleIds.add(node.getId());
int countNum = 0;
for (String moduleId : moduleIds) {
if(moduleCountMap.containsKey(moduleId)){
countNum += moduleCountMap.get(moduleId).intValue();
}
}
node.setCaseNum(countNum);
});
}
private Map<String, Integer> parseModuleCountList(List<Map<String, Object>> moduleCountList) {
Map<String,Integer> returnMap = new HashMap<>();
for (Map<String, Object> map: moduleCountList){
Object moduleIdObj = map.get("moduleId");
Object countNumObj = map.get("countNum");
if(moduleIdObj!= null && countNumObj != null){
String moduleId = String.valueOf(moduleIdObj);
try {
Integer countNumInteger = new Integer(String.valueOf(countNumObj));
returnMap.put(moduleId,countNumInteger);
}catch (Exception e){
}
}
}
return returnMap;
}
public List<String> nodeList(List<ModuleNodeDTO> testCaseNodes, String pid, List<String> list) {
for (ModuleNodeDTO node : testCaseNodes) {
//遍历出父id等于参数的idadd进子节点集合
if (StringUtils.equals(node.getParentId(), pid)) {
list.add(node.getId());
//递归遍历下一级
nodeList(testCaseNodes, node.getId(), list);
}
}
return list;
}
public int editNode(DragNodeRequest request) {
return editNodeAndNodePath(request, null);
}
protected int editNodeAndNodePath(DragNodeRequest request, Consumer<List<String>> editNodePathFunc) {
request.setUpdateTime(System.currentTimeMillis());
checkTestCaseNodeExist(request);
if (!CollectionUtils.isEmpty(request.getNodeIds()) && editNodePathFunc != null) {
editNodePathFunc.accept(request.getNodeIds());
}
return extModuleNodeMapper.updateByPrimaryKeySelective(tableName, request);
}
/**
* nodeIds 包含了删除节点ID及其所有子节点ID
* @param nodeIds
* @param deleteNodeDataFunc
* @return
*/
protected int deleteNode(List<String> nodeIds, Consumer<List<String>> deleteNodeDataFunc) {
if (CollectionUtils.isEmpty(nodeIds)) {
return 1;
}
if (deleteNodeDataFunc != null) {
// 删除node下的数据
deleteNodeDataFunc.accept(nodeIds);
}
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
testCaseNodeExample.createCriteria().andIdIn(nodeIds);
return extModuleNodeMapper.deleteByExample(tableName, testCaseNodeExample);
}
public List<ModuleNodeDTO> getNodeTreeWithPruningTree(Map<String, List<String>> projectNodeMap) {
List<ModuleNodeDTO> list = new ArrayList<>();
projectNodeMap.forEach((k, v) -> {
Project project = projectMapper.selectByPrimaryKey(k);
if (project != null) {
String name = project.getName();
List<ModuleNodeDTO> moduleNodes = getNodeTreeWithPruningTree(k, v);
ModuleNodeDTO moduleNodeDTO = new ModuleNodeDTO();
moduleNodeDTO.setId(project.getId());
moduleNodeDTO.setName(name);
moduleNodeDTO.setLabel(name);
moduleNodeDTO.setChildren(moduleNodes);
if (!CollectionUtils.isEmpty(moduleNodes)) {
list.add(moduleNodeDTO);
}
}
});
return list;
}
/**
* 获取当前项目下的
* @param projectId
* @param pruningTreeIds
* @return
*/
public List<ModuleNodeDTO> getNodeTreeWithPruningTree(String projectId, List<String> pruningTreeIds) {
List<ModuleNodeDTO> testCaseNodes = extModuleNodeMapper.getNodeTreeByProjectId(tableName, projectId);
List<ModuleNodeDTO> nodeTrees = getNodeTrees(testCaseNodes);
Iterator<ModuleNodeDTO> iterator = nodeTrees.iterator();
while (iterator.hasNext()) {
ModuleNodeDTO rootNode = iterator.next();
if (pruningTree(rootNode, pruningTreeIds)) {
iterator.remove();
}
}
return nodeTrees;
}
public Map<String, String> createNodeByTestCases(List<TestCaseWithBLOBs> testCases, String projectId) {
List<String> nodePaths = testCases.stream()
.map(TestCase::getNodePath)
.collect(Collectors.toList());
return this.createNodes(nodePaths, projectId);
}
public Map<String, String> createNodes(List<String> nodePaths, String projectId) {
List<ModuleNodeDTO> nodeTrees = getNodeTreeByProjectId(projectId);
Map<String, String> pathMap = new HashMap<>();
for (String item : nodePaths) {
if (item == null) {
throw new ExcelException(Translator.get("test_case_module_not_null"));
}
List<String> nodeNameList = new ArrayList<>(Arrays.asList(item.split("/")));
Iterator<String> itemIterator = nodeNameList.iterator();
Boolean hasNode = false;
String rootNodeName;
if (nodeNameList.size() <= 1) {
throw new ExcelException(Translator.get("test_case_create_module_fail") + ":" + item);
} else {
itemIterator.next();
itemIterator.remove();
rootNodeName = itemIterator.next().trim();
//原来没有新建的树nodeTrees也不包含
for (ModuleNodeDTO nodeTree : nodeTrees) {
if (StringUtils.equals(rootNodeName, nodeTree.getName())) {
hasNode = true;
createNodeByPathIterator(itemIterator, "/" + rootNodeName, nodeTree,
pathMap, projectId, 2);
}
;
}
}
if (!hasNode) {
createNodeByPath(itemIterator, rootNodeName, null, projectId, 1, "", pathMap);
}
}
return pathMap;
}
@Override
public String insertNode(String nodeName, String pId, String projectId, Integer level) {
ModuleNode moduleNode = new ModuleNode();
moduleNode.setName(nodeName.trim());
moduleNode.setParentId(pId);
moduleNode.setProjectId(projectId);
moduleNode.setCreateTime(System.currentTimeMillis());
moduleNode.setUpdateTime(System.currentTimeMillis());
moduleNode.setLevel(level);
moduleNode.setCreateUser(SessionUtils.getUserId());
moduleNode.setId(UUID.randomUUID().toString());
double pos = getNextLevelPos(projectId, level, pId);
moduleNode.setPos(pos);
extModuleNodeMapper.insert(tableName, moduleNode);
return moduleNode.getId();
}
public void dragNode(DragNodeRequest request) {
dragNodeAndDataEdit(request, null, null);
}
/**
* 拖拽批量修改模块以及模块下数据的 modulePath 字段
* @param request
* @param getNodeDataFunc 通过 nodeIds 获取需要修改的数据
* @param editNodeDataFunc 修改 modulePath 的方法
*/
protected void dragNodeAndDataEdit(DragNodeRequest request,
Function<List<String>, List<EditModuleDateDTO>> getNodeDataFunc,
Consumer<List<EditModuleDateDTO>> editNodeDataFunc) {
if (request.getNodeTree() == null) { return; }
checkTestCaseNodeExist(request);
List<String> nodeIds = request.getNodeIds();
TestCaseNodeDTO nodeTree = request.getNodeTree();
List<ModuleNode> updateNodes = new ArrayList<>();
if (getNodeDataFunc != null && editNodeDataFunc != null) {
List<EditModuleDateDTO> nodeData = getNodeDataFunc.apply(nodeIds);
buildUpdateTestCase(nodeTree, nodeData, updateNodes, "/", "0", 1);
editNodeDataFunc.accept(nodeData);
} else {
buildUpdateModule(nodeTree, updateNodes, "0", 1);
}
updateNodes = updateNodes.stream()
.filter(item -> nodeIds.contains(item.getId()))
.collect(Collectors.toList());
batchUpdateTestCaseNode(updateNodes);
}
private void batchUpdateTestCaseNode(List<ModuleNode> updateNodes) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ExtModuleNodeMapper extModuleNodeMapper = sqlSession.getMapper(ExtModuleNodeMapper.class);
updateNodes.forEach((value) -> {
extModuleNodeMapper.updateByPrimaryKeySelective(tableName, value);
});
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
}
private void buildUpdateModule(TestCaseNodeDTO rootNode,
List<ModuleNode> updateNodes, String pId, int level) {
checkoutNodeLimit(level);
ModuleNode moduleNode = new ModuleNode();
moduleNode.setId(rootNode.getId());
moduleNode.setLevel(level);
moduleNode.setParentId(pId);
updateNodes.add(moduleNode);
List<TestCaseNodeDTO> children = rootNode.getChildren();
if (children != null && children.size() > 0) {
for (int i = 0; i < children.size(); i++) {
buildUpdateModule(children.get(i), updateNodes, rootNode.getId(), level + 1);
}
}
}
public void checkoutNodeLimit(int level) {
if (level > 8) {
MSException.throwException(Translator.get("node_deep_limit"));
}
}
private void buildUpdateTestCase(TestCaseNodeDTO rootNode, List<EditModuleDateDTO> nodeData,
List<ModuleNode> updateNodes, String rootPath, String pId, int level) {
rootPath = rootPath + rootNode.getName();
checkoutNodeLimit(level);
ModuleNode moduleNode = new ModuleNode();
moduleNode.setId(rootNode.getId());
moduleNode.setLevel(level);
moduleNode.setParentId(pId);
updateNodes.add(moduleNode);
for (EditModuleDateDTO item : nodeData) {
if (StringUtils.equals(item.getModuleId(), rootNode.getId())) {
item.setModulePath(rootPath);
}
}
List<TestCaseNodeDTO> children = rootNode.getChildren();
if (children != null && children.size() > 0) {
for (int i = 0; i < children.size(); i++) {
buildUpdateTestCase(children.get(i), nodeData, updateNodes, rootPath + '/', rootNode.getId(), level + 1);
}
}
}
@Override
public ModuleNodeDTO getNode(String id) {
return extModuleNodeMapper.get(tableName, id);
}
@Override
public void updatePos(String id, Double pos) {
extModuleNodeMapper.updatePos(tableName, id, pos);
}
/**
* 按照指定排序方式获取同级模块的列表
*
* @param projectId 所属项目 id
* @param level node level
* @param parentId node parent id
* @param order pos 排序方式
* @return 按照指定排序方式排序的同级模块列表
*/
private List<ModuleNode> getPos(String projectId, int level, String parentId, String order) {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andProjectIdEqualTo(projectId).andLevelEqualTo(level);
if (level != 1 && StringUtils.isNotBlank(parentId)) {
criteria.andParentIdEqualTo(parentId);
}
example.setOrderByClause(order);
return extModuleNodeMapper.selectByExample(tableName, example);
}
/**
* 刷新同级模块的 pos
*
* @param projectId project id
* @param level node level
* @param parentId node parent id
*/
@Override
protected void refreshPos(String projectId, int level, String parentId) {
List<ModuleNode> nodes = getPos(projectId, level, parentId, "pos asc");
if (!CollectionUtils.isEmpty(nodes)) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ExtModuleNodeMapper extModuleNodeMapper = sqlSession.getMapper(ExtModuleNodeMapper.class);
AtomicDouble pos = new AtomicDouble(DEFAULT_POS);
nodes.forEach((node) -> {
node.setPos(pos.getAndAdd(DEFAULT_POS));
extModuleNodeMapper.updateByPrimaryKey(tableName, node);
});
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
}
}
/**
* 获得同级模块下一个 pos
*
* @param projectId project id
* @param level node level
* @param parentId node parent id
* @return 同级模块下一个 pos
*/
private double getNextLevelPos(String projectId, int level, String parentId) {
List<ModuleNode> list = getPos(projectId, level, parentId, "pos desc");
if (!CollectionUtils.isEmpty(list) && list.get(0) != null && list.get(0).getPos() != null) {
return list.get(0).getPos() + DEFAULT_POS;
} else {
return DEFAULT_POS;
}
}
public String getLogDetails(List<String> ids) {
TestCaseNodeExample example = new TestCaseNodeExample();
example.createCriteria().andIdIn(ids);
List<ModuleNode> nodes = extModuleNodeMapper.selectByExample(tableName, example);
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(nodes)) {
List<String> names = nodes.stream().map(TestCaseNode::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), nodes.get(0).getProjectId(), String.join(",", names), nodes.get(0).getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(ModuleNode node) {
ModuleNode module = null;
if (StringUtils.isNotEmpty(node.getId())) {
module = extModuleNodeMapper.selectByPrimaryKey(tableName, node.getId());
}
if (module == null && StringUtils.isNotEmpty(node.getName())) {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName()).andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotEmpty(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
if (StringUtils.isNotEmpty(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
List<ModuleNode> list = extModuleNodeMapper.selectByExample(tableName, example);
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(list)) {
module = list.get(0);
}
}
if (module != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(module, ModuleReference.moduleColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(module.getId()), module.getProjectId(), module.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
public long countById(String nodeId) {
TestCaseNodeExample example = new TestCaseNodeExample();
example.createCriteria().andIdEqualTo(nodeId);
return extModuleNodeMapper.countByExample(tableName, example);
}
public List<ModuleNode> selectSameModule(ModuleNode node) {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
return extModuleNodeMapper.selectByExample(tableName, example);
}
}

View File

@ -31,7 +31,18 @@ public class ResourceService {
if (name.contains("/")) { if (name.contains("/")) {
MSException.throwException(Translator.get("invalid_parameter")); MSException.throwException(Translator.get("invalid_parameter"));
} }
File file = new File(FileUtils.MD_IMAGE_DIR + "/" + name); return getImage(FileUtils.MD_IMAGE_DIR + "/" + name);
}
public ResponseEntity<FileSystemResource> getUiResultImage(String name) {
if (name.contains("/")) {
MSException.throwException(Translator.get("invalid_parameter"));
}
return getImage(FileUtils.UI_IMAGE_DIR + "/" + name);
}
public ResponseEntity<FileSystemResource> getImage(String path) {
File file = new File(path);
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
String fileName = encodeFileName(file.getName()); String fileName = encodeFileName(file.getName());
headers.add("Cache-Control", "no-cache, no-store, must-revalidate"); headers.add("Cache-Control", "no-cache, no-store, must-revalidate");

View File

@ -0,0 +1,12 @@
package io.metersphere.track.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class EditModuleDateDTO {
private String id;
private String moduleId;
private String modulePath;
}

View File

@ -0,0 +1,9 @@
package io.metersphere.track.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ModuleNodeDTO extends TreeNodeDTO<ModuleNodeDTO> {
}

View File

@ -1,4 +1,5 @@
package io.metersphere.track.dto; package io.metersphere.track.dto;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;

View File

@ -1,6 +1,6 @@
package io.metersphere.track.request.testcase; package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestCaseNode; import io.metersphere.base.domain.ModuleNode;
import io.metersphere.track.dto.TestCaseNodeDTO; import io.metersphere.track.dto.TestCaseNodeDTO;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -9,7 +9,7 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
public class DragNodeRequest extends TestCaseNode { public class DragNodeRequest extends ModuleNode {
List<String> nodeIds; List<String> nodeIds;
TestCaseNodeDTO nodeTree; TestCaseNodeDTO nodeTree;

View File

@ -3,6 +3,8 @@ package io.metersphere.track.request.testcase;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.List;
@Getter @Getter
@Setter @Setter
public class QueryNodeRequest { public class QueryNodeRequest {
@ -11,4 +13,5 @@ public class QueryNodeRequest {
private String projectId; private String projectId;
private String reviewId; private String reviewId;
private List<String> moduleIds;
} }

@ -1 +1 @@
Subproject commit b810af848a09181b23c3449952715de262a656e8 Subproject commit 6db272b00c0c01699aeac26ec19311d48fab1d66

View File

@ -0,0 +1,116 @@
INSERT
system_parameter
VALUES
(
'metersphere.module.ui',
'ENABLE',
'text',
1
);
CREATE TABLE `ui_scenario_module`
(
`id` varchar(50) NOT NULL COMMENT 'ui scenario node ID',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this node belongs to',
`name` varchar(64) NOT NULL COMMENT 'Node name',
`parent_id` varchar(50) DEFAULT NULL COMMENT 'Parent node ID',
`level` int(10) DEFAULT '1' COMMENT 'Node level',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
`pos` double DEFAULT NULL,
`create_user` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
CREATE TABLE `ui_scenario`
(
`id` varchar(255) NOT NULL,
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
`tags` varchar(2000) DEFAULT NULL COMMENT 'tag list',
`user_id` varchar(64) DEFAULT NULL COMMENT 'User ID',
`module_id` varchar(64) DEFAULT NULL COMMENT 'Module ID',
`module_path` varchar(1000) DEFAULT NULL,
`name` varchar(255) NOT NULL COMMENT 'ui scenario name',
`level` varchar(100) DEFAULT NULL COMMENT 'ui scenario level ',
`status` varchar(100) NOT NULL COMMENT 'ui scenario status ',
`principal` varchar(100) NOT NULL COMMENT 'ui scenario principal ',
`step_total` int(11) DEFAULT '0' COMMENT 'Step total ',
`schedule` varchar(255) DEFAULT NULL COMMENT 'Test schedule (cron list)',
`scenario_definition` longtext COMMENT 'Test scenario_definition json',
`description` longtext COMMENT 'ui scenario description',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
`pass_rate` varchar(100) DEFAULT NULL,
`last_result` varchar(100) DEFAULT NULL,
`report_id` varchar(50) DEFAULT NULL,
`num` int(11) DEFAULT NULL COMMENT 'ui scenario ID',
`original_state` varchar(64) DEFAULT NULL,
`custom_num` varchar(64) DEFAULT NULL COMMENT 'custom num',
`create_user` varchar(100) DEFAULT NULL,
`use_url` longtext COMMENT '步骤中用到的url',
`version` int(10) DEFAULT '0' COMMENT '版本号',
`delete_time` bigint(13) DEFAULT NULL COMMENT 'Delete timestamp',
`delete_user_id` varchar(64) DEFAULT NULL COMMENT 'Delete user id',
`execute_times` int(11) DEFAULT NULL,
`order` bigint(20) NOT NULL COMMENT '自定义排序间隔5000',
`environment_type` varchar(20) DEFAULT NULL,
`environment_json` longtext,
`environment_group_id` varchar(50) DEFAULT NULL,
`version_id` varchar(50) NOT NULL,
`ref_id` varchar(255) NOT NULL,
`latest` tinyint(1) DEFAULT '0' COMMENT '是否为最新版本 0:否1:是',
PRIMARY KEY (`id`),
KEY `ui_scenario_ref_id_index` (`ref_id`),
KEY `ui_scenario_version_id_index` (`version_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
CREATE TABLE `ui_element_module`
(
`id` varchar(50) NOT NULL COMMENT 'Ui scenario node ID',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this node belongs to',
`name` varchar(64) NOT NULL COMMENT 'Node name',
`parent_id` varchar(50) DEFAULT NULL COMMENT 'Parent node ID',
`level` int(10) DEFAULT '1' COMMENT 'Node level',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
`pos` double DEFAULT NULL,
`create_user` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
CREATE TABLE `ui_element` (
`id` varchar(50) NOT NULL COMMENT 'Ui element ID',
`num` int(11) DEFAULT NULL COMMENT 'Ui element ID',
`module_id` varchar(50) NOT NULL COMMENT 'Node ID this case belongs to',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
`name` varchar(255) NOT NULL COMMENT 'Ui element name',
`location_type` varchar(30) NOT NULL COMMENT 'Location type',
`location` varchar(300) NOT NULL COMMENT 'Location',
`create_user` varchar(100) DEFAULT NULL,
`version_id` varchar(50) NOT NULL COMMENT '版本ID',
`ref_id` varchar(50) NOT NULL COMMENT '指向初始版本ID',
`order` bigint(20) NOT NULL COMMENT '自定义排序间隔5000',
`latest` tinyint(1) DEFAULT '0' COMMENT '是否为最新版本 0:否1:是',
`description` varchar(1000) DEFAULT '' COMMENT '元素描述',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
PRIMARY KEY (`id`),
KEY `ui_element_order_index` (`order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
-- ui 自动化引用关系表
CREATE TABLE `ui_scenario_reference` (
`id` varchar(50) NOT NULL,
`ui_scenario_id` varchar(255) DEFAULT NULL,
`create_time` bigint(13) DEFAULT NULL,
`create_user_id` varchar(64) DEFAULT NULL,
`reference_id` varchar(255) DEFAULT NULL,
`reference_type` varchar(255) DEFAULT NULL,
`data_type` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ui_scenario_id_idx` (`ui_scenario_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
-- module management
INSERT INTO system_parameter (param_key, param_value, type, sort)
VALUES ('metersphere.module.ui', 'ENABLE', 'text', 1);

View File

@ -86,9 +86,7 @@
<!-- <ignoreColumn column="clean_load_report_expr"/>--> <!-- <ignoreColumn column="clean_load_report_expr"/>-->
<!-- <ignoreColumn column="repeatable"/>--> <!-- <ignoreColumn column="repeatable"/>-->
<!-- </table>--> <!-- </table>-->
<table tableName="api_definition_exec_result"> <table tableName="api_definition_exec_result"/>
</table>
<!--<table tableName="enterprise_test_report_send_record"/>--> <!--<table tableName="enterprise_test_report_send_record"/>-->
<!--<table tableName="test_case_review_api_case"/> <!--<table tableName="test_case_review_api_case"/>
<table tableName="test_case_review_load"/> <table tableName="test_case_review_load"/>

View File

@ -0,0 +1,53 @@
package com.test;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.Application;
import io.metersphere.xpack.ui.dto.SideDTO;
import io.metersphere.xpack.ui.impl.CommandConfig;
import io.metersphere.xpack.ui.service.UiAutomationService;
import io.metersphere.xpack.ui.util.TemplateUtils;
import io.metersphere.xpack.ui.util.WebDriverSamplerHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
/**
* UI 相关单元测试
*/
public class UITest {
@Resource
private UiAutomationService uiAutomationService;
/**
* 测试脚本转换是否正常
*/
@Test
public void testWebdriverScript() {
// 获取由 SELENIUM IDE 导出的 json 文件地址
String sidePath = this.getClass().getClassLoader().getResource("selenium-example/baidu.side").getPath();
// 读取文件内容
String sideDefinition = TemplateUtils.readContent(sidePath);
// json 字符串转化成 SideDTO 对象再调用 getFullWebDriverScript 方法翻译成最终的 webdriver 脚本
// 全局脚本配置
CommandConfig globalConfig = new CommandConfig();
globalConfig.setSecondsWaitWindowOnLoad(10);
String str = WebDriverSamplerHelper.getFullWebDriverScript(JSONObject.parseObject(sideDefinition, SideDTO.class), globalConfig);
System.out.println(str);
}
@Test
public void testUIRun() {
uiAutomationService.run("");
try {
Thread.sleep(1000 * 60 * 5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,91 @@
{
"id": "ab5c2499-cfc0-41d3-b69a-30308269863f",
"version": "2.0",
"name": "selenium-ide-test",
"url": "https://www.baidu.com/",
"tests": [{
"id": "fca44dc7-877e-47df-9e73-d3bea0be0320",
"name": "百度搜索",
"commands": [{
"id": "400885e8-805e-407e-a91e-15f45d712689",
"comment": "",
"command": "open",
"target": "https://www.baidu.com/",
"targets": [],
"value": ""
}, {
"id": "b58157d8-7c9d-4463-bd90-df0a1294e30e",
"comment": "",
"command": "setWindowSize",
"target": "601x504",
"targets": [],
"value": ""
}, {
"id": "33414f80-f6a9-4cce-9ee4-bac1e1491184",
"comment": "",
"command": "click",
"target": "id=kw",
"targets": [
["id=kw", "id"],
["name=wd", "name"],
["css=#kw", "css:finder"],
["xpath=//input[@id='kw']", "xpath:attributes"],
["xpath=//form[@id='form']/span/input", "xpath:idRelative"],
["xpath=//span/input", "xpath:position"]
],
"value": ""
}, {
"id": "db6983a2-aaa7-4768-8da7-8020ee095f28",
"comment": "",
"command": "type",
"target": "id=kw",
"targets": [
["id=kw", "id"],
["name=wd", "name"],
["css=#kw", "css:finder"],
["xpath=//input[@id='kw']", "xpath:attributes"],
["xpath=//form[@id='form']/span/input", "xpath:idRelative"],
["xpath=//span/input", "xpath:position"]
],
"value": "fitcloud"
}, {
"id": "ca4ea118-0544-4ab7-92fd-83f390e076bf",
"comment": "",
"command": "sendKeys",
"target": "id=kw",
"targets": [
["id=kw", "id"],
["name=wd", "name"],
["css=#kw", "css:finder"],
["xpath=//input[@id='kw']", "xpath:attributes"],
["xpath=//form[@id='form']/span/input", "xpath:idRelative"],
["xpath=//span/input", "xpath:position"]
],
"value": "${KEY_ENTER}"
}, {
"id": "b4455e18-60ba-4b62-bb80-807b30085698",
"comment": "",
"command": "runScript",
"target": "window.scrollTo(0,0)",
"targets": [],
"value": ""
}, {
"id": "f48f0d94-6744-4361-a481-53ab862c90bf",
"comment": "",
"command": "close",
"target": "",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "9f022119-ec73-4f6a-a82b-15fd0606d76e",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": []
}],
"urls": ["https://wiki.fit2cloud.com/"],
"plugins": []
}

View File

@ -1,6 +1,7 @@
import {getUUID} from "@/common/js/utils"; import {getUUID} from "@/common/js/utils";
import {getUploadConfig, request} from "@/common/js/ajax"; import {getUploadConfig, request} from "@/common/js/ajax";
import {basePost} from "@/network/base-network"; import {basePost} from "@/network/base-network";
import {ELEMENT_TYPE} from "@/business/components/api/automation/scenario/Setting";
function buildBodyFile(item, bodyUploadFiles, obj, bodyParam) { function buildBodyFile(item, bodyUploadFiles, obj, bodyParam) {
if (bodyParam) { if (bodyParam) {
@ -122,3 +123,86 @@ export function savePreciseEnvProjectIds(projectIds, envMap) {
} }
} }
} }
export function scenarioSort(_this) {
for (let i in _this.scenarioDefinition) {
// 排序
_this.scenarioDefinition[i].index = Number(i) + 1;
// 设置循环控制
if (_this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && _this.scenarioDefinition[i].hashTree
&& _this.scenarioDefinition[i].hashTree.length > 1) {
_this.scenarioDefinition[i].countController.proceed = true;
}
// 设置项目ID
if (!_this.scenarioDefinition[i].projectId) {
_this.scenarioDefinition[i].projectId = _this.projectId;
}
if (_this.scenarioDefinition[i].hashTree != undefined && _this.scenarioDefinition[i].hashTree.length > 0) {
if (_this.hideTreeNode) {
_this.hideTreeNode(_this.scenarioDefinition[i], _this.scenarioDefinition[i].hashTree);
}
recursiveSorting(_this, _this.scenarioDefinition[i].hashTree, _this.scenarioDefinition[i].projectId);
}
// 添加debug结果
if (_this.debugResult && _this.debugResult.get(_this.scenarioDefinition[i].id + _this.scenarioDefinition[i].name)) {
_this.scenarioDefinition[i].requestResult = _this.debugResult.get(_this.scenarioDefinition[i].id + _this.scenarioDefinition[i].name);
}
}
}
export function recursiveSorting(_this, arr, scenarioProjectId) {
for (let i in arr) {
arr[i].index = Number(i) + 1;
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true;
}
if (!arr[i].projectId) {
arr[i].projectId = scenarioProjectId ? scenarioProjectId : _this.projectId;
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
if (_this.hideTreeNode) {
_this.hideTreeNode(arr[i], arr[i].hashTree);
}
recursiveSorting(arr[i].hashTree, arr[i].projectId);
}
// 添加debug结果
if (_this.debugResult && _this.debugResult.get(arr[i].id + arr[i].name)) {
arr[i].requestResult = _this.debugResult.get(arr[i].id + arr[i].name);
}
}
}
export function copyScenarioRow(row, node) {
if (!row || !node) {
return;
}
const parent = node.parent
const hashTree = parent.data.hashTree || parent.data;
// 深度复制
let obj = JSON.parse(JSON.stringify(row));
if (obj.hashTree && obj.hashTree.length > 0) {
resetResourceId(obj.hashTree);
}
obj.resourceId = getUUID();
if (obj.name) {
obj.name = obj.name + '_copy';
}
const index = hashTree.findIndex(d => d.resourceId === row.resourceId);
if (index != -1) {
hashTree.splice(index + 1, 0, obj);
} else {
hashTree.push(obj);
}
}
export function resetResourceId(hashTree) {
hashTree.forEach(item => {
item.resourceId = getUUID();
if (item.hashTree && item.hashTree.length > 0) {
resetResourceId(item.hashTree);
}
})
}

View File

@ -7,7 +7,9 @@
:debug="debug" :report="report" @reportExport="handleExport" :debug="debug" :report="report" @reportExport="handleExport"
@reportSave="handleSave"/> @reportSave="handleSave"/>
<main v-if="isNotRunning"> <main v-if="isNotRunning">
<ms-metric-chart :content="content" :totalTime="totalTime" :report="report"/> <ms-metric-chart :content="content" :totalTime="totalTime" :report="report"/>
<div> <div>
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('api_report.total')" name="total"> <el-tab-pane :label="$t('api_report.total')" name="total">

View File

@ -167,13 +167,8 @@ export default {
MsTabButton, MsTabButton,
MsRequestResultTail, MsRequestResultTail,
}, },
computed: { props: {
leftActive() { reportType: String
return this.trashActiveDom === 'left';
},
rightActive() {
return this.trashActiveDom === 'right';
},
}, },
data() { data() {
return { return {
@ -241,7 +236,17 @@ export default {
this.search(); this.search();
} }
}, },
computed: {
leftActive() {
return this.trashActiveDom === 'left';
},
rightActive() {
return this.trashActiveDom === 'right';
},
isUI() {
return this.reportType && this.reportType === 'UI';
}
},
methods: { methods: {
search() { search() {
if (this.testId !== 'all') { if (this.testId !== 'all') {
@ -251,6 +256,9 @@ export default {
this.selectAll = false; this.selectAll = false;
this.unSelection = []; this.unSelection = [];
this.selectDataCounts = 0; this.selectDataCounts = 0;
this.condition.reportType = this.reportType;
let url = '' let url = ''
if(this.trashActiveDom==='left'){ if(this.trashActiveDom==='left'){
this.reportTypeFilters =this.reportScenarioFilters; this.reportTypeFilters =this.reportScenarioFilters;
@ -259,6 +267,7 @@ export default {
this.reportTypeFilters =this.reportCaseFilters; this.reportTypeFilters =this.reportCaseFilters;
url = "/api/execute/result/list/" + this.currentPage + "/" + this.pageSize; url = "/api/execute/result/list/" + this.currentPage + "/" + this.pageSize;
} }
this.result = this.$post(url, this.condition, response => { this.result = this.$post(url, this.condition, response => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
@ -297,7 +306,7 @@ export default {
this.$warning(this.$t('commons.run_warning')) this.$warning(this.$t('commons.run_warning'))
return; return;
} }
if (report.reportType.indexOf('SCENARIO') !== -1 || report.reportType === 'API_INTEGRATED') { if (report.reportType.indexOf('SCENARIO') !== -1 || report.reportType.indexOf('UI_') !== -1 || report.reportType === 'API_INTEGRATED') {
this.currentProjectId = report.projectId; this.currentProjectId = report.projectId;
this.$router.push({ this.$router.push({
path: 'report/view/' + report.id, path: 'report/view/' + report.id,

View File

@ -11,10 +11,10 @@
<div v-if="isExport"> <div v-if="isExport">
<span class="ms-req ms-req-error" v-if="content.error && content.error>0"> <span class="ms-req ms-req-error" v-if="content.error && content.error>0">
<span class="ms-req-span"> {{ content.success + content.error }} 请求</span> <span class="ms-req-span"> {{ content.success + content.error }} {{isUi ? '步骤' : $t('api_report.request')}}</span>
</span> </span>
<span class="ms-req ms-req-success" v-else> <span class="ms-req ms-req-success" v-else>
<span class="ms-req-span"> {{ content.success ? content.success + content.error : 0 }} 请求</span> <span class="ms-req-span"> {{ content.success ? content.success + content.error : 0 }} {{isUi ? '步骤' : $t('api_report.request')}}</span>
</span> </span>
</div> </div>
<ms-chart id="chart" ref="chart" :options="options" :height="220" style="margin-right: 10px" <ms-chart id="chart" ref="chart" :options="options" :height="220" style="margin-right: 10px"
@ -141,10 +141,10 @@
<div class="value">{{ errorCodeAssertions }}</div> <div class="value">{{ errorCodeAssertions }}</div>
<div class="name">{{ $t('error_report_library.assertion') }}</div> <div class="name">{{ $t('error_report_library.assertion') }}</div>
</div> </div>
<div class="metric-icon-box"> <div class="metric-icon-box" v-if="!isUi">
<i class="el-icon-document-copy total"></i> <i class="el-icon-document-copy total"></i>
<div class="value">{{ this.content.total }}</div> <div class="value">{{ this.content.total }}</div>
<div class="name">{{ $t('api_report.request') }}</div> <div class="name">{{ isUi ? '步骤' : $t('api_report.request') }}</div>
</div> </div>
</el-row> </el-row>
</div> </div>
@ -260,7 +260,6 @@ export default {
] ]
}; };
}, },
fail() { fail() {
return (this.content.error / this.content.total * 100).toFixed(0) + "%"; return (this.content.error / this.content.total * 100).toFixed(0) + "%";
}, },
@ -269,7 +268,10 @@ export default {
}, },
errorCodeAssertions() { errorCodeAssertions() {
return this.content.errorCode + " / " + this.content.totalAssertions; return this.content.errorCode + " / " + this.content.totalAssertions;
} },
isUi() {
return this.$route.meta && this.$route.meta.isUi;
},
}, },
} }
</script> </script>

View File

@ -1,6 +1,12 @@
<template> <template>
<div class="scenario-result"> <div class="scenario-result">
<div v-if="(node.children && node.children.length >0) || node.unsolicited <div v-if="node.type === 'MsUiCommand'">
<ui-command-result
:index-number="node.index"
:command="node"
:result="node.value"/>
</div>
<div v-else-if="(node.children && node.children.length >0) || node.unsolicited
|| (node.type && this.stepFilter.get('AllSamplerProxy').indexOf(node.type) === -1)"> || (node.type && this.stepFilter.get('AllSamplerProxy').indexOf(node.type) === -1)">
<el-card class="ms-card"> <el-card class="ms-card">
<div class="el-step__icon is-text ms-api-col"> <div class="el-step__icon is-text ms-api-col">
@ -30,10 +36,11 @@
<script> <script>
import MsRequestResult from "./RequestResult"; import MsRequestResult from "./RequestResult";
import {STEP} from "@/business/components/api/automation/scenario/Setting"; import {STEP} from "@/business/components/api/automation/scenario/Setting";
import UiCommandResult from "@/business/components/api/automation/report/components/UiCommandResult";
export default { export default {
name: "MsScenarioResult", name: "MsScenarioResult",
components: {MsRequestResult}, components: {UiCommandResult, MsRequestResult},
props: { props: {
scenario: Object, scenario: Object,
node: Object, node: Object,

View File

@ -0,0 +1,193 @@
<template>
<el-card class="ms-cards">
<div class="request-result">
<div>
<el-row :gutter="16" type="flex" align="middle" class="info">
<el-col class="ms-req-name-col" :span="18" v-if="indexNumber != undefined">
<div class="method ms-req-name">
<div class="el-step__icon is-text ms-api-col-create">
<div class="el-step__icon-inner"> {{ indexNumber }}</div>
</div>
<span>{{ label }}</span>
</div>
</el-col>
<el-col :span="3">
<span v-if="result" :style="!result.success ? 'color: #FE6F71' : ''">
{{ result.endTime - result.startTime }} ms
</span>
</el-col>
<el-col :span="3">
<el-popover
placement="right"
trigger="hover"
popper-class="issues-popover"
v-if="result">
<el-image
style="width: 100px; height: 100px"
:src="'/resource/ui/get?fileName=' + result.url"
:preview-src-list="['/resource/ui/get?fileName=' + result.url]">
</el-image>
<el-button slot="reference" type="text">{{ $t('截图') }}</el-button>
</el-popover>
</el-col>
<el-col :span="2">
<div>
<el-tag size="mini" v-if="!result">
{{ $t('api_test.home_page.detail_card.unexecute') }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="result.success">
{{ $t('api_report.success') }}
</el-tag>
<el-tooltip v-else :content="result.body" placement="top">
<el-tag size="mini" type="danger" >
{{ $t('api_report.fail') }}
</el-tag>
</el-tooltip>
</div>
</el-col>
</el-row>
</div>
</div>
</el-card>
</template>
<script>
import commandDefinition from "@/business/components/xpack/ui/definition/command-definition";
export default {
name: "UiCommandResult",
props: {
indexNumber: Number,
result: Object,
command: Object
},
computed: {
label() {
return this.command.label ? commandDefinition[this.command.label].cnName : '';
}
},
data() {
return {
}
},
methods: {
},
}
</script>
<style scoped>
.request-result {
min-height: 30px;
padding: 2px 0;
}
.request-result .info {
margin-left: 20px;
cursor: pointer;
}
.request-result .method {
color: #1E90FF;
font-size: 14px;
font-weight: 500;
line-height: 35px;
padding-left: 5px;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.request-result .url {
color: #7f7f7f;
font-size: 12px;
font-weight: 400;
margin-top: 4px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
.request-result .tab .el-tabs__header {
margin: 0;
}
.request-result .text {
height: 300px;
overflow-y: auto;
}
.sub-result .info {
background-color: #FFF;
}
.sub-result .method {
border-left: 5px solid #1E90FF;
padding-left: 20px;
}
.ms-cards >>> .el-card__body {
padding: 1px;
}
.sub-result:last-child {
border-bottom: 1px solid #EBEEF5;
}
.ms-test-running {
color: #6D317C;
}
.ms-test-error_code {
color: #F6972A;
background-color: #FDF5EA;
border-color: #FDF5EA;
}
.ms-api-col {
background-color: #EFF0F0;
border-color: #EFF0F0;
margin-right: 10px;
font-size: 12px;
color: #64666A;
}
.ms-api-col-create {
background-color: #EBF2F2;
border-color: #008080;
margin-right: 10px;
font-size: 12px;
color: #008080;
}
/deep/ .el-step__icon {
width: 20px;
height: 20px;
font-size: 12px;
}
.el-divider--horizontal {
margin: 2px 0;
background: 0 0;
border-top: 1px solid #e8eaec;
}
.ms-req-name {
display: inline-block;
margin: 0 5px;
padding-bottom: 0;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
width: 350px;
}
.ms-req-name-col {
overflow-x: hidden;
}
</style>

View File

@ -79,7 +79,12 @@ export default {
reqObj.variables = this.runData.variables; reqObj.variables = this.runData.variables;
} }
this.$emit('runRefresh', {}); this.$emit('runRefresh', {});
saveScenario('/api/automation/run/debug', reqObj, this.runData.hashTree, this, (response) => {
let url = '/api/automation/run/debug';
if (this.runData.type === 'UiScenario') {
url = '/ui/automation/run/debug';
}
saveScenario(url, reqObj, this.runData.hashTree, this, (response) => {
this.runId = response.data; this.runId = response.data;
}); });
}, },

View File

@ -51,6 +51,7 @@ export const ELEMENT_TYPE = {
export const TYPE_TO_C = new Map([ export const TYPE_TO_C = new Map([
['scenario', 'io.metersphere.api.dto.definition.request.MsScenario'], ['scenario', 'io.metersphere.api.dto.definition.request.MsScenario'],
['UiScenario', 'io.metersphere.xpack.ui.hashtree.MsUiScenario'],
['HTTPSamplerProxy', 'io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy'], ['HTTPSamplerProxy', 'io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy'],
['DubboSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDubboSampler'], ['DubboSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDubboSampler'],
['JDBCSampler', 'io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler'], ['JDBCSampler', 'io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler'],

View File

@ -35,10 +35,17 @@
<div v-if="!ifFromVariableAdvance" class="header-right" @click.stop> <div v-if="!ifFromVariableAdvance" class="header-right" @click.stop>
<slot name="message" v-show="!isMax"></slot> <slot name="message" v-show="!isMax"></slot>
<slot name="debugStepCode"></slot> <slot name="debugStepCode"></slot>
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn"> <el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
<el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="(data.disabled && !data.root) || !showVersion" style="width: 30px"/> <el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="(data.disabled && !data.root) || !showVersion" style="width: 30px"/>
</el-tooltip> </el-tooltip>
<slot name="button"></slot>
<slot name="button" v-if="showVersion"></slot>
<el-tooltip content="Copy" placement="top" v-if="showVersion && showCopy">
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px" :disabled="data.disabled && !data.root"/>
</el-tooltip>
<el-button v-if="showVersion" size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px" <el-button v-if="showVersion" size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px"
:disabled="(data.disabled && !data.root) || !showVersion "/> :disabled="(data.disabled && !data.root) || !showVersion "/>
@ -49,6 +56,7 @@
:environmentType="environmentType" :environmentType="environmentType"
:environmentGroupId="environmentGroupId" :environmentGroupId="environmentGroupId"
:envMap="envMap" :envMap="envMap"
@enable="enable"
@copy="copyRow" @copy="copyRow"
@remove="remove" @remove="remove"
@openScenario="openScenario" @openScenario="openScenario"
@ -147,6 +155,14 @@ export default {
environmentType: String, environmentType: String,
environmentGroupId: String, environmentGroupId: String,
envMap: Map, envMap: Map,
showEnable : {
type: Boolean,
default : true
},
showCopy : {
type: Boolean,
default : true
},
}, },
watch: { watch: {
'$store.state.selectStep': function () { '$store.state.selectStep': function () {
@ -227,6 +243,9 @@ export default {
} else { } else {
$event.currentTarget.className = "scenario-version" $event.currentTarget.className = "scenario-version"
} }
},
enable() {
this.data.enable = !this.data.enable;
} }
} }
} }

View File

@ -10,6 +10,7 @@
:timer="scenario" :timer="scenario"
:assertions="scenario" :assertions="scenario"
:extract="scenario" :extract="scenario"
:command="scenario"
:jsr223-processor="scenario" :jsr223-processor="scenario"
:request="scenario" :request="scenario"
:currentScenario="currentScenario" :currentScenario="currentScenario"
@ -51,6 +52,9 @@ import MsLoopController from "./LoopController";
import MsApiScenarioComponent from "./ApiScenarioComponent"; import MsApiScenarioComponent from "./ApiScenarioComponent";
import JmeterElementComponent from "./JmeterElementComponent"; import JmeterElementComponent from "./JmeterElementComponent";
import PluginComponent from "./PluginComponent"; import PluginComponent from "./PluginComponent";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const MsUiCommand = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/scenario/component/MsUiCommandComponent.vue") : {};
const MsUiScenarioComponent = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/scenario/component/MsUiScenarioComponent.vue") : {};
export default { export default {
name: "ComponentConfig", name: "ComponentConfig",
@ -67,11 +71,15 @@ export default {
MsApiAssertions: () => import("../../../definition/components/assertion/ApiAssertions"), MsApiAssertions: () => import("../../../definition/components/assertion/ApiAssertions"),
MsApiExtract: () => import("../../../definition/components/extract/ApiExtract"), MsApiExtract: () => import("../../../definition/components/extract/ApiExtract"),
MsJdbcProcessor: () => import("@/business/components/api/automation/scenario/component/JDBCProcessor"), MsJdbcProcessor: () => import("@/business/components/api/automation/scenario/component/JDBCProcessor"),
// MsUiCommand: () => import("@/business/components/xpack/ui/automation/scenario/component/MsUiCommandComponent")
'MsUiCommand': MsUiCommand.default,
'MsUiScenarioComponent': MsUiScenarioComponent.default,
}, },
props: { props: {
type: String, type: String,
message: String, message: String,
scenario: {}, scenario: {},
command: {},
draggable: { draggable: {
type: Boolean, type: Boolean,
default: true, default: true,
@ -171,6 +179,9 @@ export default {
case "TCPSampler": case "TCPSampler":
name = "MsApiComponent"; name = "MsApiComponent";
break; break;
case "MsUiCommand":
name = "MsUiCommand";
break;
default: default:
name = this.getComponent(ELEMENT_TYPE.Plugin); name = this.getComponent(ELEMENT_TYPE.Plugin);
break; break;

View File

@ -5,6 +5,9 @@
<el-icon class="el-icon-more"></el-icon> <el-icon class="el-icon-more"></el-icon>
</el-link> </el-link>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="copy" v-if="data.command">{{ this.$t('commons.copy') }}</el-dropdown-item>
<el-dropdown-item command="enable" v-if="data.command && data.enable">{{ this.$t('ui.disable') }}</el-dropdown-item>
<el-dropdown-item command="enable" v-if="data.command && !data.enable">{{ this.$t('ui.enable') }}</el-dropdown-item>
<el-dropdown-item command="remove">{{ this.$t('api_test.automation.delete_step') }}</el-dropdown-item> <el-dropdown-item command="remove">{{ this.$t('api_test.automation.delete_step') }}</el-dropdown-item>
<el-dropdown-item command="scenarioVar" v-if="data.type==='scenario'"> <el-dropdown-item command="scenarioVar" v-if="data.type==='scenario'">
{{ this.$t("api_test.automation.view_scene_variables") }} {{ this.$t("api_test.automation.view_scene_variables") }}
@ -89,6 +92,9 @@ export default {
case "setScenario": case "setScenario":
this.setScenario(); this.setScenario();
break; break;
case "enable":
this.$emit("enable");
break;
} }
}, },
setVariables(v, h) { setVariables(v, h) {

View File

@ -221,7 +221,7 @@ import {exportPdf, getCurrentProjectID, getUUID, hasLicense, strMapToObj} from "
import "@/common/css/material-icons.css" import "@/common/css/material-icons.css"
import OutsideClick from "@/common/js/outside-click"; import OutsideClick from "@/common/js/outside-click";
import {handleCtrlSEvent} from "../../../../../../common/js/utils"; import {handleCtrlSEvent} from "../../../../../../common/js/utils";
import {saveScenario} from "@/business/components/api/automation/api-automation"; import {copyScenarioRow, saveScenario, scenarioSort} from "@/business/components/api/automation/api-automation";
import {buttons, setComponent} from '../menu/Menu'; import {buttons, setComponent} from '../menu/Menu';
import MsContainer from "../../../../common/components/MsContainer"; import MsContainer from "../../../../common/components/MsContainer";
import MsMainContainer from "../../../../common/components/MsMainContainer"; import MsMainContainer from "../../../../common/components/MsMainContainer";
@ -509,25 +509,6 @@ export default {
apiListImport() { apiListImport() {
this.$refs.scenarioApiRelevance.open(); this.$refs.scenarioApiRelevance.open();
}, },
recursiveSorting(arr, scenarioProjectId) {
for (let i in arr) {
arr[i].index = Number(i) + 1;
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true;
}
if (!arr[i].projectId) {
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.hideTreeNode(arr[i], arr[i].hashTree);
this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
}
// debug
if (this.debugResult && this.debugResult.get(arr[i].id + arr[i].name)) {
arr[i].requestResult = this.debugResult.get(arr[i].id + arr[i].name);
}
}
},
openOrClose(node) { openOrClose(node) {
node.expanded = !node.expanded; node.expanded = !node.expanded;
if (node.expanded) { if (node.expanded) {
@ -553,28 +534,7 @@ export default {
node.isLeaf = isLeaf; node.isLeaf = isLeaf;
}, },
sort() { sort() {
for (let i in this.scenarioDefinition) { scenarioSort(this);
//
this.scenarioDefinition[i].index = Number(i) + 1;
//
if (this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && this.scenarioDefinition[i].hashTree
&& this.scenarioDefinition[i].hashTree.length > 1) {
this.scenarioDefinition[i].countController.proceed = true;
}
// ID
if (!this.scenarioDefinition[i].projectId) {
this.scenarioDefinition[i].projectId = this.projectId;
}
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.hideTreeNode(this.scenarioDefinition[i], this.scenarioDefinition[i].hashTree);
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
}
// debug
if (this.debugResult && this.debugResult.get(this.scenarioDefinition[i].id + this.scenarioDefinition[i].name)) {
this.scenarioDefinition[i].requestResult = this.debugResult.get(this.scenarioDefinition[i].id + this.scenarioDefinition[i].name);
}
}
}, },
addCustomizeApi(request) { addCustomizeApi(request) {
this.customizeVisible = false; this.customizeVisible = false;
@ -676,37 +636,10 @@ export default {
}); });
}, },
copyRow(row, node) { copyRow(row, node) {
if (!row || !node) { copyScenarioRow(row, node);
return;
}
const parent = node.parent
const hashTree = parent.data.hashTree || parent.data;
//
let obj = JSON.parse(JSON.stringify(row));
if (obj.hashTree && obj.hashTree.length > 0) {
this.resetResourceId(obj.hashTree);
}
obj.resourceId = getUUID();
if (obj.name) {
obj.name = obj.name + '_copy';
}
const index = hashTree.findIndex(d => d.resourceId === row.resourceId);
if (index != -1) {
hashTree.splice(index + 1, 0, obj);
} else {
hashTree.push(obj);
}
this.sort(); this.sort();
this.reload(); this.reload();
}, },
resetResourceId(hashTree) {
hashTree.forEach(item => {
item.resourceId = getUUID();
if (item.hashTree && item.hashTree.length > 0) {
this.resetResourceId(item.hashTree);
}
})
},
showHide() { showHide() {
this.showHideTree = false this.showHideTree = false
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -256,7 +256,7 @@ export default {
setContentType(value) { setContentType(value) {
let isType = false; let isType = false;
this.headers.forEach(item => { this.headers.forEach(item => {
if (item.name === "Content-Type") { if (item.name === "Content-Type" || item.name == "contentType") {
item.value = value; item.value = value;
isType = true; isType = true;
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<el-input class="ms-search-bar" :placeholder="$t('test_track.module.search')" v-model="condition.filterText" size="small"> <el-input class="ms-search-bar" :placeholder="$t('test_track.module.search')" v-model="condition.filterText" size="small">
<template v-if="showOperator" v-slot:append> <template v-if="showOperator && commands" v-slot:append>
<el-dropdown> <el-dropdown>
<el-button type="primary"> <el-button type="primary">
<span class="tip-font">{{ $t('commons.more_operator') }}</span> <span class="tip-font">{{ $t('commons.more_operator') }}</span>
@ -53,17 +53,7 @@ export default {
} }
}, },
showOperator: Boolean, showOperator: Boolean,
commands: { commands: Array
type: Array,
default() {
return [
{
label: this.$t('api_test.api_import.label'),
callback: () => {}
}
]
}
}
}, },
methods: { methods: {
click(item) { click(item) {

View File

@ -22,6 +22,10 @@
v-permission="['PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ']"> v-permission="['PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ']">
{{ $t('commons.api') }} {{ $t('commons.api') }}
</el-menu-item> </el-menu-item>
<el-menu-item index="/ui" @click="active()" v-if="check('ui')" onselectstart="return false"
v-permission="['PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ']">
{{ $t('commons.ui') }}
</el-menu-item>
<el-menu-item index="/performance" v-if="check('performance')" <el-menu-item index="/performance" v-if="check('performance')"
onselectstart="return false" onselectstart="return false"
v-permission="['PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ']"> v-permission="['PROJECT_PERFORMANCE_TEST:READ','PROJECT_PERFORMANCE_REPORT:READ']">

View File

@ -20,7 +20,8 @@ const router = new VueRouter({
sidebar: RouterSidebar sidebar: RouterSidebar
} }
}, },
...requireContext.keys().map(key => requireContext(key).workstation), ...requireContext.keys().map(k => requireContext(k).workstation),
...requireContext.keys().map(k => requireContext(k).ui),
Setting, Setting,
API, API,
Performance, Performance,

View File

@ -27,6 +27,7 @@
@click.native="selectClick" @click.native="selectClick"
@remove-tag="removeTag" @remove-tag="removeTag"
@clear="clean" @clear="clean"
:placeholder="placeholder"
class="ms-tree-select"> class="ms-tree-select">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
@ -136,6 +137,12 @@ export default {
default() { default() {
return '300px'; return '300px';
} }
},
placeholder: {
type: String,
default() {
return this.$t('el.select.placeholder');
}
} }
}, },
// //
@ -229,6 +236,9 @@ export default {
return; return;
} }
} }
} else {
this.returnDataKeys = this.defaultKey;
this.setKey(this.defaultKey);
} }
}, },
//select[] //select[]
@ -364,7 +374,9 @@ export default {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const n = data[i]; const n = data[i];
if (n[this.obj.pid] === id) { if (n[this.obj.pid] === id) {
if (this.obj.children) {
n[this.obj.children] = fa(n[this.obj.id]); n[this.obj.children] = fa(n[this.obj.id]);
}
temp.push(n); temp.push(n);
} }
} }

View File

@ -1,4 +1,4 @@
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/); const requireContext = require.context('@/business/components/xpack/', false, /router\.js$/);
export default { export default {
path: "/setting", path: "/setting",

@ -1 +1 @@
Subproject commit ee0fe3faff0ae3ef3c7fe0bf4e69c5eedae443a4 Subproject commit 3a9fb4e1dda6fe241d782f1fad6f58fe92a991f3

View File

@ -233,6 +233,18 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'description', key: '7', label: 'test_track.issue.description'}, {id: 'description', key: '7', label: 'test_track.issue.description'},
{id: 'caseCount', key: '9', label: 'api_test.definition.api_case_number'}, {id: 'caseCount', key: '9', label: 'api_test.definition.api_case_number'},
{id: 'createTime', key: '8', label: 'commons.create_time'}, {id: 'createTime', key: '8', label: 'commons.create_time'},
],
//缺陷列表
ELEMENT_LIST: [
{id: 'num', key: '1', label: 'test_track.issue.id'},
{id: 'name', key: '2', label: '元素名称'},
{id: 'modulePath', key: '3', label: '所属页面'},
{id: 'locationType', key: '4', label: '定位类型'},
{id: 'location', key: '5', label: '元素定位'},
{id: 'creatorUser', key: '6', label: 'test_track.issue.issue_resource'},
{id: 'createTime', key: '7', label: 'commons.create_time'},
{id: 'updateTime', key: '8', label: 'commons.update_time'},
] ]
} }

View File

@ -19,6 +19,17 @@ export const CUSTOM_FIELD_TYPE_OPTION = [
{value: 'multipleInput',text: 'workspace.custom_filed.multipleInput'} {value: 'multipleInput',text: 'workspace.custom_filed.multipleInput'}
]; ];
export const UI_ELEMENT_LOCATION_TYPE_OPTION = [
{value: 'id',text: 'id'},
{value: 'name',text: 'name'},
{value: 'class',text: 'class'},
{value: 'tag',text: 'tag'},
{value: 'link',text: 'link'},
{value: 'plink',text: 'plink'},
{value: 'css',text: 'css'},
{value: 'xpath',text: 'xpath'}
];
export const CUSTOM_FIELD_SCENE_OPTION = [ export const CUSTOM_FIELD_SCENE_OPTION = [
{value: 'TEST_CASE',text: 'workspace.case_template_manage'}, {value: 'TEST_CASE',text: 'workspace.case_template_manage'},
{value: 'ISSUE',text: 'workspace.issue_template_manage'}, {value: 'ISSUE',text: 'workspace.issue_template_manage'},

View File

@ -441,7 +441,8 @@ export default {
sync_other_info: "Copy other config", sync_other_info: "Copy other config",
delete_current_version: 'Current version', delete_current_version: 'Current version',
delete_all_version: 'All versions', delete_all_version: 'All versions',
change_password_tips: 'Your password is the initial system password, please change it as soon as possible' change_password_tips: 'Your password is the initial system password, please change it as soon as possible',
ui: 'UI TEST',
}, },
login: { login: {
normal_Login: "Normal Login", normal_Login: "Normal Login",
@ -3096,5 +3097,10 @@ export default {
match_type: { match_type: {
text: "TXT" text: "TXT"
} }
},
ui: {
ui_automation: "UI Automation",
ui_element: "UI Element Library",
report: "Test Report",
} }
}; };

View File

@ -444,6 +444,7 @@ export default {
delete_current_version: '列表版本', delete_current_version: '列表版本',
delete_all_version: '全部版本', delete_all_version: '全部版本',
change_password_tips: '您的密码是系统初始密码,请尽快修改密码', change_password_tips: '您的密码是系统初始密码,请尽快修改密码',
ui: 'UI 测试',
}, },
login: { login: {
normal_Login: "普通登录", normal_Login: "普通登录",
@ -3100,5 +3101,26 @@ export default {
match_type: { match_type: {
text: "文本" text: "文本"
} }
},
ui: {
ui_automation: "UI 自动化",
ui_element: "元素库",
report: "测试报告",
scenario_list: "场景列表",
selenium_tip: "支持 Selenium-IDE 插件格式导入",
selenium_export_tip: "通过 MeterSphere 导出 side 文件",
elementObject: "元素对象",
elementLocator: "元素定位",
elementType: "所属分类",
not_selected: "(未选择元素)",
not_selected_location: "(未选择元素定位)",
location: "定位",
run: "运行",
locate_type: "定位方式",
coord: "坐标",
enable_or_not: "启用/禁用",
enable: "启用",
disable: "禁用",
resolution: "分辨率",
} }
}; };

View File

@ -444,6 +444,7 @@ export default {
delete_current_version: '列表版本', delete_current_version: '列表版本',
delete_all_version: '全部版本', delete_all_version: '全部版本',
change_password_tips: '您的密碼是系統初始密碼,請盡快修改密碼', change_password_tips: '您的密碼是系統初始密碼,請盡快修改密碼',
ui: 'UI 測試',
}, },
login: { login: {
normal_Login: "普通登錄", normal_Login: "普通登錄",
@ -3099,5 +3100,10 @@ export default {
match_type: { match_type: {
text: "文本" text: "文本"
} }
},
ui: {
ui_automation: "UI 自動化",
ui_element: "元素庫",
report: "測試報告",
} }
}; };

View File

@ -36,6 +36,12 @@ const state = {
curTabId: null, curTabId: null,
testCaseDefaultValue: {}, testCaseDefaultValue: {},
forceRerenderIndex: "", forceRerenderIndex: "",
currentScenario: {},
scenarioDefinition: {},
selectCommand: {},
//按照type分组的指令
groupedCmd: {},
librarySelectElement: {}
} }
const store = new Vuex.Store({ const store = new Vuex.Store({

View File

@ -19,6 +19,12 @@ const mutations = {
setTestCaseTemplate: (state, value) => state.testCaseTemplate = value, setTestCaseTemplate: (state, value) => state.testCaseTemplate = value,
setCurTabId: (state, value) => state.curTabId = value, setCurTabId: (state, value) => state.curTabId = value,
setTestCaseDefaultValue: (state, value) => state.testCaseDefaultValue = value, setTestCaseDefaultValue: (state, value) => state.testCaseDefaultValue = value,
setSelectCommand: (state, value) => state.selectCommand = value,
setSelectStep: (state, value) => state.selectStep = value,
setLibrarySelectElement: (state, value) => state.librarySelectElement = value,
setCurrentScenario: (state, value) => state.currentScenario = value,
setScenarioDefinition: (state, value) => state.scenarioDefinition = value,
setGroupedCmd: (state, value) => state.groupedCmd = value,
} }
export default mutations; export default mutations;