parent
4d1a44823c
commit
c824ae45ab
|
@ -389,4 +389,9 @@ public class ApiDefinitionController {
|
||||||
apiDefinitionService.deleteApiDefinitionByVersion(refId, version);
|
apiDefinitionService.deleteApiDefinitionByVersion(refId, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/be/cited/scenario/{definitionId}")
|
||||||
|
public Integer getCitedScenarioCount(@PathVariable String definitionId) {
|
||||||
|
return apiDefinitionService.getCitedScenarioCount(definitionId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,9 +170,12 @@ public class ApiDefinitionService {
|
||||||
private ApiAutomationService apiAutomationService;
|
private ApiAutomationService apiAutomationService;
|
||||||
@Resource
|
@Resource
|
||||||
private FileAssociationService fileAssociationService;
|
private FileAssociationService fileAssociationService;
|
||||||
|
@Resource
|
||||||
|
private ApiScenarioReferenceIdMapper apiScenarioReferenceIdMapper;
|
||||||
|
|
||||||
private final ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
private final ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
||||||
private final ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
private final ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
||||||
|
private static final String COPY = "Copy";
|
||||||
|
|
||||||
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
|
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
|
||||||
request = this.initRequest(request, true, true);
|
request = this.initRequest(request, true, true);
|
||||||
|
@ -860,7 +863,7 @@ public class ApiDefinitionService {
|
||||||
saveFollows(test.getId(), request.getFollows());
|
saveFollows(test.getId(), request.getFollows());
|
||||||
}
|
}
|
||||||
// 存储附件关系
|
// 存储附件关系
|
||||||
fileAssociationService.saveApi(test.getId(), request.getRequest(),FileAssociationType.API.name());
|
fileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationType.API.name());
|
||||||
|
|
||||||
return getById(test.getId());
|
return getById(test.getId());
|
||||||
}
|
}
|
||||||
|
@ -938,7 +941,7 @@ public class ApiDefinitionService {
|
||||||
for (int i = 0; i < caseList.size(); i++) {
|
for (int i = 0; i < caseList.size(); i++) {
|
||||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = caseList.get(i);
|
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = caseList.get(i);
|
||||||
apiTestCaseWithBLOBs.setApiDefinitionId(apiDefinition.getId());
|
apiTestCaseWithBLOBs.setApiDefinitionId(apiDefinition.getId());
|
||||||
if (apiDefinition.getToBeUpdated() && StringUtils.equalsIgnoreCase(apiTestCaseWithBLOBs.getVersionId(), "old_case")) {
|
if (apiDefinition.getToBeUpdated() != null && apiDefinition.getToBeUpdated() && StringUtils.equalsIgnoreCase(apiTestCaseWithBLOBs.getVersionId(), "old_case")) {
|
||||||
apiTestCaseWithBLOBs.setToBeUpdated(true);
|
apiTestCaseWithBLOBs.setToBeUpdated(true);
|
||||||
} else {
|
} else {
|
||||||
apiTestCaseWithBLOBs.setToBeUpdated(false);
|
apiTestCaseWithBLOBs.setToBeUpdated(false);
|
||||||
|
@ -2695,4 +2698,11 @@ public class ApiDefinitionService {
|
||||||
extApiDefinitionMapper.updateNoModuleApiToDefaultModule(projectId, protocol, status, versionId, id);
|
extApiDefinitionMapper.updateNoModuleApiToDefaultModule(projectId, protocol, status, versionId, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getCitedScenarioCount(String testId) {
|
||||||
|
ApiScenarioReferenceIdExample apiScenarioReferenceIdExample = new ApiScenarioReferenceIdExample();
|
||||||
|
apiScenarioReferenceIdExample.createCriteria().andDataTypeEqualTo(ReportTriggerMode.API.name()).andReferenceTypeEqualTo(COPY).andReferenceIdEqualTo(testId);
|
||||||
|
List<ApiScenarioReferenceId> apiScenarioReferenceIds = apiScenarioReferenceIdMapper.selectByExample(apiScenarioReferenceIdExample);
|
||||||
|
return apiScenarioReferenceIds.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1305,6 +1305,7 @@ public class ApiTestCaseService {
|
||||||
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
|
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
|
||||||
if (toBeUpdatedTime != null) {
|
if (toBeUpdatedTime != null) {
|
||||||
request.setToBeUpdateTime(toBeUpdatedTime);
|
request.setToBeUpdateTime(toBeUpdatedTime);
|
||||||
|
request.setUpdateTime(toBeUpdatedTime);
|
||||||
}
|
}
|
||||||
List<String> syncRuleCaseStatus = apiTestCaseSyncService.getSyncRuleCaseStatus(request.getProjectId());
|
List<String> syncRuleCaseStatus = apiTestCaseSyncService.getSyncRuleCaseStatus(request.getProjectId());
|
||||||
if (CollectionUtils.isEmpty(syncRuleCaseStatus)) {
|
if (CollectionUtils.isEmpty(syncRuleCaseStatus)) {
|
||||||
|
|
|
@ -513,10 +513,11 @@
|
||||||
and t1.to_be_updated = #{request.toBeUpdated}
|
and t1.to_be_updated = #{request.toBeUpdated}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.toBeUpdated !=null and request.toBeUpdated == true and request.toBeUpdateTime !=null and request.statusList.size() > 0">
|
<if test="request.toBeUpdated !=null and request.toBeUpdated == true and request.toBeUpdateTime !=null and request.statusList.size() > 0">
|
||||||
and (t1.to_be_update_time >= #{request.toBeUpdateTime} or t1.status in
|
and (t1.to_be_update_time >= #{request.toBeUpdateTime} or ( t1.status in
|
||||||
<foreach collection="request.statusList" item="value" separator="," open="(" close=")">
|
<foreach collection="request.statusList" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>)
|
</foreach>
|
||||||
|
and t1.update_time>= #{request.updateTime} ))
|
||||||
</if>
|
</if>
|
||||||
<if test="request.toBeUpdated !=null and request.toBeUpdated == true and request.toBeUpdateTime !=null and request.statusList.size() == 0">
|
<if test="request.toBeUpdated !=null and request.toBeUpdated == true and request.toBeUpdateTime !=null and request.statusList.size() == 0">
|
||||||
and t1.to_be_update_time >= #{request.toBeUpdateTime}
|
and t1.to_be_update_time >= #{request.toBeUpdateTime}
|
||||||
|
|
|
@ -370,7 +370,8 @@ export default {
|
||||||
syncCase: true,
|
syncCase: true,
|
||||||
sendNotice: true,
|
sendNotice: true,
|
||||||
},
|
},
|
||||||
noShowSyncRuleRelation: false
|
noShowSyncRuleRelation: false,
|
||||||
|
citedScenarioCount: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}, syncTabs: Array, projectId: String},
|
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}, syncTabs: Array, projectId: String},
|
||||||
|
@ -583,7 +584,7 @@ export default {
|
||||||
this.httpForm.versionId = this.$refs.versionHistory.currentVersion.id;
|
this.httpForm.versionId = this.$refs.versionHistory.currentVersion.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasLicense() && this.httpForm.caseTotal > 0 && !this.httpForm.isCopy) {
|
if (hasLicense() && (this.httpForm.caseTotal > 0 || this.citedScenarioCount > 0) && !this.httpForm.isCopy) {
|
||||||
if ((this.httpForm.method !== this.beforeHttpForm.method) && !this.noShowSyncRuleRelation) {
|
if ((this.httpForm.method !== this.beforeHttpForm.method) && !this.noShowSyncRuleRelation) {
|
||||||
this.batchSyncApiVisible = true;
|
this.batchSyncApiVisible = true;
|
||||||
}
|
}
|
||||||
|
@ -964,6 +965,13 @@ export default {
|
||||||
this.noShowSyncRuleRelation = false;
|
this.noShowSyncRuleRelation = false;
|
||||||
this.saveApi();
|
this.saveApi();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
getCitedScenarioCount() {
|
||||||
|
this.$get('/api/definition/be/cited/scenario/' + this.httpForm.id, response => {
|
||||||
|
if (response.data) {
|
||||||
|
this.citedScenarioCount = response.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -993,6 +1001,7 @@ export default {
|
||||||
if (hasLicense()) {
|
if (hasLicense()) {
|
||||||
this.getVersionHistory();
|
this.getVersionHistory();
|
||||||
this.getSyncRule();
|
this.getSyncRule();
|
||||||
|
this.getCitedScenarioCount();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
Loading…
Reference in New Issue