fix(接口测试首页 接口测试): 修复新建接口无执行记录时统计报错的问题,新项目下创建接口测试时Mock相关功能报错的问题 (#5531)
修复新建接口无执行记录时统计报错的问题,新项目下创建接口测试时Mock相关功能报错的问题 Co-authored-by: song-tianyang <tianyang.song@fit2cloud.com>
This commit is contained in:
parent
fe96b6694f
commit
da7b8d0e76
|
@ -2497,6 +2497,11 @@ public class ApiAutomationService {
|
|||
}
|
||||
|
||||
public long countExecuteTimesByProjectID(String projectId) {
|
||||
return extApiScenarioMapper.countExeciteTimesByProjectID(projectId);
|
||||
Long result = extApiScenarioMapper.countExecuteTimesByProjectID(projectId);
|
||||
if(result == null){
|
||||
return 0;
|
||||
}else {
|
||||
return result.longValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ public class ApiDefinitionExecResultService {
|
|||
apiCase.setStatus(status);
|
||||
apiCase.setUpdateTime(System.currentTimeMillis());
|
||||
testPlanApiCaseService.updateByPrimaryKeySelective(apiCase);
|
||||
} else if (StringUtils.equals(type, ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
|
||||
} else if (StringUtils.equals(type, ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
TestPlanApiCase apiCase = testPlanApiCaseService.getById(item.getName());
|
||||
userID = Objects.requireNonNull(SessionUtils.getUser()).getId();
|
||||
apiCase.setStatus(status);
|
||||
|
|
|
@ -109,12 +109,14 @@ public class MockConfigService {
|
|||
|
||||
MockConfig config = new MockConfig();
|
||||
config.setProjectId(request.getProjectId());
|
||||
config.setApiId(request.getApiId());
|
||||
config.setId(UUID.randomUUID().toString());
|
||||
config.setCreateUserId(SessionUtils.getUserId());
|
||||
config.setCreateTime(createTimeStmp);
|
||||
config.setUpdateTime(createTimeStmp);
|
||||
mockConfigMapper.insert(config);
|
||||
if(request.getApiId() != null){
|
||||
config.setApiId(request.getApiId());
|
||||
mockConfigMapper.insert(config);
|
||||
}
|
||||
returnRsp = new MockConfigResponse(config, new ArrayList<>());
|
||||
} else {
|
||||
MockConfig config = configList.get(0);
|
||||
|
|
|
@ -71,5 +71,5 @@ public interface ExtApiScenarioMapper {
|
|||
|
||||
List<String> selectIdsByExecuteTimeIsNull();
|
||||
|
||||
long countExeciteTimesByProjectID(String projectId);
|
||||
Long countExecuteTimesByProjectID(String projectId);
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="countExeciteTimesByProjectID" resultType="java.lang.Long">
|
||||
<select id="countExecuteTimesByProjectID" resultType="java.lang.Long">
|
||||
SELECT SUM(execute_times) FROM api_scenario
|
||||
WHERE project_id = #{0}
|
||||
</select>
|
||||
|
|
|
@ -176,12 +176,14 @@ export default {
|
|||
mockSetting() {
|
||||
let mockParam = {};
|
||||
mockParam.projectId = this.projectId;
|
||||
mockParam.apiId = this.currentApi.id;
|
||||
this.$post('/mockConfig/genMockConfig', mockParam, response => {
|
||||
let mockConfig = response.data;
|
||||
mockConfig.apiName = this.currentApi.name;
|
||||
this.baseMockConfigData = mockConfig;
|
||||
});
|
||||
if(this.currentApi.id){
|
||||
mockParam.apiId = this.currentApi.id;
|
||||
this.$post('/mockConfig/genMockConfig', mockParam, response => {
|
||||
let mockConfig = response.data;
|
||||
mockConfig.apiName = this.currentApi.name;
|
||||
this.baseMockConfigData = mockConfig;
|
||||
});
|
||||
}
|
||||
},
|
||||
runTest(data) {
|
||||
this.$emit("runTest", data);
|
||||
|
|
Loading…
Reference in New Issue