fix(接口定义): 创建其他版本接口定义,提示ID已存在
--bug=1009908 --user=lyh 【接口定义】开启了自定义用例ID,创建其他版本接口定义,提示ID已存在 https://www.tapd.cn/55049933/s/1097514
This commit is contained in:
parent
ab97478583
commit
333c3713d2
|
@ -302,10 +302,15 @@ public class ApiAutomationService {
|
||||||
|
|
||||||
private void checkCustomNumExist(SaveApiScenarioRequest request) {
|
private void checkCustomNumExist(SaveApiScenarioRequest request) {
|
||||||
ApiScenarioExample example = new ApiScenarioExample();
|
ApiScenarioExample example = new ApiScenarioExample();
|
||||||
example.createCriteria()
|
String id = request.getId();
|
||||||
.andCustomNumEqualTo(request.getCustomNum())
|
ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id);
|
||||||
|
ApiScenarioExample.Criteria criteria = example.createCriteria();
|
||||||
|
criteria.andCustomNumEqualTo(request.getCustomNum())
|
||||||
.andProjectIdEqualTo(request.getProjectId())
|
.andProjectIdEqualTo(request.getProjectId())
|
||||||
.andIdNotEqualTo(request.getId());
|
.andIdNotEqualTo(id);
|
||||||
|
if (apiScenarioWithBLOBs != null && StringUtils.isNotBlank(apiScenarioWithBLOBs.getRefId())) {
|
||||||
|
criteria.andRefIdNotEqualTo(apiScenarioWithBLOBs.getRefId());
|
||||||
|
}
|
||||||
List<ApiScenario> list = apiScenarioMapper.selectByExample(example);
|
List<ApiScenario> list = apiScenarioMapper.selectByExample(example);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
MSException.throwException("自定义ID " + request.getCustomNum() + " 已存在!");
|
MSException.throwException("自定义ID " + request.getCustomNum() + " 已存在!");
|
||||||
|
@ -374,6 +379,13 @@ public class ApiAutomationService {
|
||||||
apiScenarioMapper.insertSelective(scenario);
|
apiScenarioMapper.insertSelective(scenario);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(request.getCustomNum()) && !StringUtils.equals(request.getCustomNum(), beforeScenario.getCustomNum())) {
|
||||||
|
example.clear();
|
||||||
|
example.createCriteria().andRefIdEqualTo(beforeScenario.getRefId());
|
||||||
|
ApiScenarioWithBLOBs apiScenarioWithBLOBs = new ApiScenarioWithBLOBs();
|
||||||
|
apiScenarioWithBLOBs.setCustomNum(request.getCustomNum());
|
||||||
|
apiScenarioMapper.updateByExampleSelective(apiScenarioWithBLOBs, example);
|
||||||
|
}
|
||||||
|
|
||||||
apiScenarioReferenceIdService.saveByApiScenario(scenario);
|
apiScenarioReferenceIdService.saveByApiScenario(scenario);
|
||||||
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name,同步到修改首页定时任务
|
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name,同步到修改首页定时任务
|
||||||
|
|
Loading…
Reference in New Issue