refactor(工作台): 页面优化

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-23 17:29:00 +08:00 committed by xiaomeinvG
parent 70e7b2ba4f
commit 8d5d99077d
4 changed files with 25 additions and 8 deletions

View File

@ -752,7 +752,12 @@ public class ApiDefinitionService {
if (request.getToBeUpdated() != null) {
toBeUpdated = request.getToBeUpdated();
}
apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol(), toBeUpdated);
ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest();
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
if (apiDefinitionSyncService != null) {
apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(request.getProjectId());
}
apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol(), toBeUpdated, apiSyncCaseRequest);
}
//
ApiDefinitionWithBLOBs result = apiDefinitionMapper.selectByPrimaryKey(test.getId());
@ -1114,6 +1119,9 @@ public class ApiDefinitionService {
} else if (apiTestImportRequest.getCoverModule() != null && apiTestImportRequest.getCoverModule()) {
apiDefinition.setUpdateTime(System.currentTimeMillis());
}
if (CollectionUtils.isEmpty(caseList)) {
apiDefinition.setToBeUpdated(false);
}
} else {
apiDefinition.setUpdateTime(System.currentTimeMillis());
}

View File

@ -827,7 +827,7 @@ public class ApiTestCaseService {
}
}
public void updateByApiDefinitionId(List<String> ids, String path, String method, String protocol, Boolean toBeUpdated) {
public void updateByApiDefinitionId(List<String> ids, String path, String method, String protocol, Boolean toBeUpdated, ApiSyncCaseRequest apiSyncCaseRequest) {
if ((StringUtils.isNotEmpty(method) || StringUtils.isNotEmpty(path) && RequestType.HTTP.equals(protocol))) {
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
apiDefinitionExample.createCriteria().andApiDefinitionIdIn(ids);
@ -858,7 +858,16 @@ public class ApiTestCaseService {
String requestStr = JSON.toJSONString(req);
apiTestCase.setRequest(requestStr);
if (toBeUpdated != null) {
apiTestCase.setToBeUpdated(toBeUpdated);
if (apiSyncCaseRequest.getUnRun() != null && apiSyncCaseRequest.getUnRun() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash")
&& !apiTestCase.getStatus().equalsIgnoreCase("success") && !apiTestCase.getStatus().equalsIgnoreCase("error")
&& !apiTestCase.getStatus().equalsIgnoreCase("Running") && !apiTestCase.getStatus().equalsIgnoreCase("errorReportResult")
&& !apiTestCase.getStatus().equalsIgnoreCase("STOP")) {
apiTestCase.setToBeUpdated(true);
} else
apiTestCase.setToBeUpdated(apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash")
&& !apiTestCase.getStatus().equalsIgnoreCase("error"));
if (toBeUpdated) {
apiTestCase.setToBeUpdateTime(System.currentTimeMillis());
}

View File

@ -503,7 +503,7 @@
and (t1.status is null or t1.status != 'Trash')
</if>
<if test="request.toBeUpdated !=null and request.toBeUpdated == true">
and (t1.to_be_updated = #{request.toBeUpdated} or t3.status = 'error')
and t1.to_be_updated = #{request.toBeUpdated}
</if>
<if test="request.toBeUpdated !=null and request.toBeUpdated == true and request.toBeUpdateTime !=null">
and (t1.to_be_update_time >= #{request.toBeUpdateTime})

View File

@ -234,8 +234,8 @@
<el-row>
<el-col :span="4">{{ $t('project.code_segment.result') + ":" }}</el-col>
<el-col :span="20" style="color: #783887">
<el-checkbox v-model="apiSyncCaseRequest.failed">{{ $t('schedule.event_failed') }}</el-checkbox>
<el-checkbox v-model="apiSyncCaseRequest.unExecute">{{ $t('api_test.home_page.detail_card.unexecute') }}
<el-checkbox v-model="apiSyncCaseRequest.runError">{{ $t('schedule.event_failed') }}</el-checkbox>
<el-checkbox v-model="apiSyncCaseRequest.unRun">{{ $t('api_test.home_page.detail_card.unexecute') }}
</el-checkbox>
</el-col>
</el-row>
@ -410,8 +410,8 @@ export default {
query: true,
rest: true,
body: true,
failed: true,
unExecute: true
runError: true,
unRun: true
}
}
this.apiSyncCaseRequest.protocol = true;