parent
9e71aee670
commit
380c93c26b
|
@ -0,0 +1,22 @@
|
|||
package io.metersphere.api.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ApiSyncRuleRelationRequest {
|
||||
private String resourceId;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
private Boolean showUpdateRule;
|
||||
|
||||
private boolean caseCreator;
|
||||
|
||||
private boolean scenarioCreator;
|
||||
|
||||
private boolean syncCase;
|
||||
|
||||
private boolean sendNotice;
|
||||
|
||||
private String apiSyncCaseRequest;
|
||||
}
|
|
@ -1,8 +1,14 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import io.metersphere.api.dto.definition.ApiSyncCaseRequest;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestCase;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
|
||||
public interface ApiCaseBatchSyncService {
|
||||
void oneClickSyncCase(ApiSyncCaseRequest apiSyncCaseRequest, ApiDefinitionWithBLOBs apiDefinitionWithBLOBs);
|
||||
void oneClickSyncCase(String apiUpdateRule, ApiDefinitionWithBLOBs apiDefinitionWithBLOBs, ApiTestCaseMapper apiTestCaseMapper, ApiTestCaseWithBLOBs testCases);
|
||||
|
||||
void sendApiNotice(ApiDefinitionWithBLOBs apiDefinitionWithBLOBs);
|
||||
|
||||
void sendCaseNotice(ApiTestCase apiTestCase);
|
||||
}
|
||||
|
|
|
@ -161,9 +161,11 @@ public class ApiDefinitionService {
|
|||
@Resource
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private ApiScenarioReferenceIdMapper apiScenarioReferenceIdMapper;
|
||||
private ApiDefinitionSyncService apiDefinitionSyncService;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
private ApiCaseBatchSyncService apiCaseSyncService;
|
||||
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private ApiAutomationService apiAutomationService;
|
||||
|
@ -398,86 +400,25 @@ public class ApiDefinitionService {
|
|||
if (StringUtils.equals(request.getProtocol(), "DUBBO")) {
|
||||
request.setMethod("dubbo://");
|
||||
}
|
||||
if (StringUtils.isBlank(request.getTriggerUpdate())) {
|
||||
// 设置是否需要进入待更新列表
|
||||
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
|
||||
if (apiDefinitionSyncService != null) {
|
||||
apiDefinitionSyncService.syncApi(request);
|
||||
}
|
||||
|
||||
// 设置是否需要进入待更新列表
|
||||
if (apiDefinitionSyncService != null) {
|
||||
apiDefinitionSyncService.syncApi(request);
|
||||
}
|
||||
|
||||
ApiDefinitionWithBLOBs returnModel = updateTest(request);
|
||||
if (StringUtils.isNotBlank(request.getTriggerUpdate())) {
|
||||
//一键同步case
|
||||
ApiSyncCaseRequest apiSyncCaseRequest = JSONObject.parseObject(request.getTriggerUpdate(), ApiSyncCaseRequest.class);
|
||||
ApiCaseBatchSyncService apiCaseSyncService = CommonBeanFactory.getBean(ApiCaseBatchSyncService.class);
|
||||
if (apiCaseSyncService != null) {
|
||||
apiCaseSyncService.oneClickSyncCase(apiSyncCaseRequest, returnModel);
|
||||
}
|
||||
}
|
||||
|
||||
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
|
||||
mockConfigService.updateMockReturnMsgByApi(returnModel);
|
||||
FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles);
|
||||
// 发送通知
|
||||
String context = SessionUtils.getUserId() + "更新了接口定义:" + returnModel.getName();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("projectId", request.getProjectId());
|
||||
paramMap.put("operator", SessionUtils.getUserId());
|
||||
paramMap.put("id", returnModel.getId());
|
||||
paramMap.put("name", returnModel.getName());
|
||||
paramMap.put("createUser", returnModel.getCreateUser());
|
||||
paramMap.put("userId", returnModel.getUserId());
|
||||
|
||||
Set<String> specialReceiversSet = new HashSet<>();
|
||||
this.getReceivers(request, returnModel, specialReceiversSet);
|
||||
List<String> specialReceivers = new ArrayList<>(specialReceiversSet);
|
||||
if (request.getSendSpecialMessage() != null && request.getSendSpecialMessage()) {
|
||||
paramMap.put("specialReceivers", JSON.toJSONString(specialReceivers));
|
||||
paramMap.put("apiSpecialType", "API_SPECIAL");
|
||||
// 发送通知
|
||||
if (apiCaseSyncService != null) {
|
||||
apiCaseSyncService.sendApiNotice(returnModel);
|
||||
}
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.context(context)
|
||||
.testId(returnModel.getId())
|
||||
.subject("接口更新通知")
|
||||
.paramMap(paramMap)
|
||||
.event(NoticeConstants.Event.UPDATE)
|
||||
.build();
|
||||
noticeSendService.send(NoticeConstants.TaskType.API_DEFINITION_TASK, noticeModel);
|
||||
return getById(returnModel.getId());
|
||||
}
|
||||
|
||||
private void getReceivers(SaveApiDefinitionRequest request, ApiDefinitionWithBLOBs returnModel, Set<String> specialReceivers) {
|
||||
if (request.getSendSpecialMessage() != null && request.getSendSpecialMessage()) {
|
||||
if (request.getCaseCreator() != null && request.getCaseCreator()) {
|
||||
ApiTestCaseExample apiTestCaseExample = new ApiTestCaseExample();
|
||||
apiTestCaseExample.createCriteria().andApiDefinitionIdEqualTo(returnModel.getId());
|
||||
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(apiTestCaseExample);
|
||||
if (CollectionUtils.isNotEmpty(apiTestCases)) {
|
||||
for (ApiTestCase apiTestCase : apiTestCases) {
|
||||
specialReceivers.add(apiTestCase.getCreateUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (request.getScenarioCreator() != null && request.getScenarioCreator()) {
|
||||
ApiScenarioReferenceIdExample apiScenarioReferenceIdExample = new ApiScenarioReferenceIdExample();
|
||||
apiScenarioReferenceIdExample.createCriteria().andDataTypeEqualTo("API").andReferenceIdEqualTo(returnModel.getId());
|
||||
List<ApiScenarioReferenceId> apiScenarioReferenceIds = apiScenarioReferenceIdMapper.selectByExample(apiScenarioReferenceIdExample);
|
||||
if (CollectionUtils.isNotEmpty(apiScenarioReferenceIds)) {
|
||||
List<String> scenarioIds = apiScenarioReferenceIds.stream().map(ApiScenarioReferenceId::getApiScenarioId).collect(Collectors.toList());
|
||||
ApiScenarioExample apiScenarioExample = new ApiScenarioExample();
|
||||
apiScenarioExample.createCriteria().andIdIn(scenarioIds);
|
||||
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(apiScenarioExample);
|
||||
if (CollectionUtils.isNotEmpty(apiScenarios)) {
|
||||
for (ApiScenario apiScenario : apiScenarios) {
|
||||
specialReceivers.add(apiScenario.getCreateUser());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkQuota(String projectId) {
|
||||
QuotaService quotaService = CommonBeanFactory.getBean(QuotaService.class);
|
||||
|
@ -773,23 +714,12 @@ public class ApiDefinitionService {
|
|||
|
||||
apiDefinitionMapper.insertSelective(test);
|
||||
}
|
||||
|
||||
// 同步修改用例路径
|
||||
if (StringUtils.equals(test.getProtocol(), "HTTP")) {
|
||||
List<String> ids = new ArrayList<>();
|
||||
ids.add(request.getId());
|
||||
Boolean toBeUpdated = null;
|
||||
if (request.getToBeUpdated() != null) {
|
||||
toBeUpdated = request.getToBeUpdated();
|
||||
}
|
||||
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);
|
||||
apiTestCaseService.updateByApiDefinitionId(ids, test, request.getTriggerUpdate());
|
||||
}
|
||||
//
|
||||
ApiDefinitionWithBLOBs result = apiDefinitionMapper.selectByPrimaryKey(test.getId());
|
||||
checkAndSetLatestVersion(result.getRefId());
|
||||
return result;
|
||||
|
@ -1208,7 +1138,6 @@ public class ApiDefinitionService {
|
|||
e.printStackTrace();
|
||||
}
|
||||
ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest();
|
||||
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
|
||||
if (apiDefinitionSyncService != null) {
|
||||
apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(existApi.getProjectId());
|
||||
}
|
||||
|
@ -1238,7 +1167,6 @@ public class ApiDefinitionService {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JsonNode exApiRequest = null;
|
||||
|
|
|
@ -118,6 +118,8 @@ public class ApiTestCaseService {
|
|||
private ExtApiDefinitionMapper extApiDefinitionMapper;
|
||||
@Resource
|
||||
private ProjectApplicationMapper projectApplicationMapper;
|
||||
@Resource
|
||||
private ApiCaseBatchSyncService apiCaseSyncService;
|
||||
|
||||
|
||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||
|
@ -325,6 +327,10 @@ public class ApiTestCaseService {
|
|||
} else {
|
||||
FileUtils.createBodyFiles(request.getId(), bodyFiles);
|
||||
}
|
||||
// 发送通知
|
||||
if (apiCaseSyncService != null) {
|
||||
apiCaseSyncService.sendCaseNotice(test);
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
|
@ -834,7 +840,10 @@ public class ApiTestCaseService {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateByApiDefinitionId(List<String> ids, String path, String method, String protocol, Boolean toBeUpdated, ApiSyncCaseRequest apiSyncCaseRequest) {
|
||||
public void updateByApiDefinitionId(List<String> ids, ApiDefinitionWithBLOBs test, String apiUpdateRule) {
|
||||
String method = test.getMethod();
|
||||
String path = test.getPath();
|
||||
String protocol = test.getProtocol();
|
||||
if ((StringUtils.isNotEmpty(method) || StringUtils.isNotEmpty(path) && RequestType.HTTP.equals(protocol))) {
|
||||
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
|
||||
apiDefinitionExample.createCriteria().andApiDefinitionIdIn(ids);
|
||||
|
@ -864,11 +873,9 @@ public class ApiTestCaseService {
|
|||
}
|
||||
String requestStr = JSON.toJSONString(req);
|
||||
apiTestCase.setRequest(requestStr);
|
||||
if (toBeUpdated != null) {
|
||||
apiTestCase.setToBeUpdated(toBeUpdated);
|
||||
if (toBeUpdated) {
|
||||
apiTestCase.setToBeUpdateTime(System.currentTimeMillis());
|
||||
}
|
||||
// sync case
|
||||
if (apiCaseSyncService != null) {
|
||||
apiCaseSyncService.oneClickSyncCase(apiUpdateRule, test, batchMapper, apiTestCase);
|
||||
}
|
||||
batchMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiSyncRuleRelation implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String resourceId;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
private Boolean showUpdateRule;
|
||||
|
||||
private Boolean caseCreator;
|
||||
|
||||
private Boolean scenarioCreator;
|
||||
|
||||
private Boolean syncCase;
|
||||
|
||||
private Boolean sendNotice;
|
||||
|
||||
private String apiSyncCaseRequest;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,710 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiSyncRuleRelationExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public ApiSyncRuleRelationExample() {
|
||||
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 andResourceIdIsNull() {
|
||||
addCriterion("resource_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNotNull() {
|
||||
addCriterion("resource_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdEqualTo(String value) {
|
||||
addCriterion("resource_id =", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotEqualTo(String value) {
|
||||
addCriterion("resource_id <>", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThan(String value) {
|
||||
addCriterion("resource_id >", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id >=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThan(String value) {
|
||||
addCriterion("resource_id <", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id <=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLike(String value) {
|
||||
addCriterion("resource_id like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotLike(String value) {
|
||||
addCriterion("resource_id not like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIn(List<String> values) {
|
||||
addCriterion("resource_id in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotIn(List<String> values) {
|
||||
addCriterion("resource_id not in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIsNull() {
|
||||
addCriterion("resource_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIsNotNull() {
|
||||
addCriterion("resource_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeEqualTo(String value) {
|
||||
addCriterion("resource_type =", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotEqualTo(String value) {
|
||||
addCriterion("resource_type <>", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeGreaterThan(String value) {
|
||||
addCriterion("resource_type >", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_type >=", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLessThan(String value) {
|
||||
addCriterion("resource_type <", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_type <=", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLike(String value) {
|
||||
addCriterion("resource_type like", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotLike(String value) {
|
||||
addCriterion("resource_type not like", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIn(List<String> values) {
|
||||
addCriterion("resource_type in", values, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotIn(List<String> values) {
|
||||
addCriterion("resource_type not in", values, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeBetween(String value1, String value2) {
|
||||
addCriterion("resource_type between", value1, value2, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_type not between", value1, value2, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleIsNull() {
|
||||
addCriterion("show_update_rule is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleIsNotNull() {
|
||||
addCriterion("show_update_rule is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleEqualTo(Boolean value) {
|
||||
addCriterion("show_update_rule =", value, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleNotEqualTo(Boolean value) {
|
||||
addCriterion("show_update_rule <>", value, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleGreaterThan(Boolean value) {
|
||||
addCriterion("show_update_rule >", value, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("show_update_rule >=", value, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleLessThan(Boolean value) {
|
||||
addCriterion("show_update_rule <", value, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("show_update_rule <=", value, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleIn(List<Boolean> values) {
|
||||
addCriterion("show_update_rule in", values, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleNotIn(List<Boolean> values) {
|
||||
addCriterion("show_update_rule not in", values, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("show_update_rule between", value1, value2, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andShowUpdateRuleNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("show_update_rule not between", value1, value2, "showUpdateRule");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorIsNull() {
|
||||
addCriterion("case_creator is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorIsNotNull() {
|
||||
addCriterion("case_creator is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorEqualTo(Boolean value) {
|
||||
addCriterion("case_creator =", value, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorNotEqualTo(Boolean value) {
|
||||
addCriterion("case_creator <>", value, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorGreaterThan(Boolean value) {
|
||||
addCriterion("case_creator >", value, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("case_creator >=", value, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorLessThan(Boolean value) {
|
||||
addCriterion("case_creator <", value, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("case_creator <=", value, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorIn(List<Boolean> values) {
|
||||
addCriterion("case_creator in", values, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorNotIn(List<Boolean> values) {
|
||||
addCriterion("case_creator not in", values, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("case_creator between", value1, value2, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseCreatorNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("case_creator not between", value1, value2, "caseCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorIsNull() {
|
||||
addCriterion("scenario_creator is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorIsNotNull() {
|
||||
addCriterion("scenario_creator is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorEqualTo(Boolean value) {
|
||||
addCriterion("scenario_creator =", value, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorNotEqualTo(Boolean value) {
|
||||
addCriterion("scenario_creator <>", value, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorGreaterThan(Boolean value) {
|
||||
addCriterion("scenario_creator >", value, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("scenario_creator >=", value, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorLessThan(Boolean value) {
|
||||
addCriterion("scenario_creator <", value, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("scenario_creator <=", value, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorIn(List<Boolean> values) {
|
||||
addCriterion("scenario_creator in", values, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorNotIn(List<Boolean> values) {
|
||||
addCriterion("scenario_creator not in", values, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("scenario_creator between", value1, value2, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioCreatorNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("scenario_creator not between", value1, value2, "scenarioCreator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseIsNull() {
|
||||
addCriterion("sync_case is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseIsNotNull() {
|
||||
addCriterion("sync_case is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseEqualTo(Boolean value) {
|
||||
addCriterion("sync_case =", value, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseNotEqualTo(Boolean value) {
|
||||
addCriterion("sync_case <>", value, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseGreaterThan(Boolean value) {
|
||||
addCriterion("sync_case >", value, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("sync_case >=", value, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseLessThan(Boolean value) {
|
||||
addCriterion("sync_case <", value, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("sync_case <=", value, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseIn(List<Boolean> values) {
|
||||
addCriterion("sync_case in", values, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseNotIn(List<Boolean> values) {
|
||||
addCriterion("sync_case not in", values, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("sync_case between", value1, value2, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSyncCaseNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("sync_case not between", value1, value2, "syncCase");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeIsNull() {
|
||||
addCriterion("send_notice is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeIsNotNull() {
|
||||
addCriterion("send_notice is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeEqualTo(Boolean value) {
|
||||
addCriterion("send_notice =", value, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeNotEqualTo(Boolean value) {
|
||||
addCriterion("send_notice <>", value, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeGreaterThan(Boolean value) {
|
||||
addCriterion("send_notice >", value, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("send_notice >=", value, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeLessThan(Boolean value) {
|
||||
addCriterion("send_notice <", value, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("send_notice <=", value, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeIn(List<Boolean> values) {
|
||||
addCriterion("send_notice in", values, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeNotIn(List<Boolean> values) {
|
||||
addCriterion("send_notice not in", values, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("send_notice between", value1, value2, "sendNotice");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSendNoticeNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("send_notice not between", value1, value2, "sendNotice");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.ApiSyncRuleRelation;
|
||||
import io.metersphere.base.domain.ApiSyncRuleRelationExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiSyncRuleRelationMapper {
|
||||
long countByExample(ApiSyncRuleRelationExample example);
|
||||
|
||||
int deleteByExample(ApiSyncRuleRelationExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(ApiSyncRuleRelation record);
|
||||
|
||||
int insertSelective(ApiSyncRuleRelation record);
|
||||
|
||||
List<ApiSyncRuleRelation> selectByExampleWithBLOBs(ApiSyncRuleRelationExample example);
|
||||
|
||||
List<ApiSyncRuleRelation> selectByExample(ApiSyncRuleRelationExample example);
|
||||
|
||||
ApiSyncRuleRelation selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiSyncRuleRelation record, @Param("example") ApiSyncRuleRelationExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") ApiSyncRuleRelation record, @Param("example") ApiSyncRuleRelationExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiSyncRuleRelation record, @Param("example") ApiSyncRuleRelationExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiSyncRuleRelation record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(ApiSyncRuleRelation record);
|
||||
|
||||
int updateByPrimaryKey(ApiSyncRuleRelation record);
|
||||
}
|
|
@ -0,0 +1,324 @@
|
|||
<?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.ApiSyncRuleRelationMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
||||
<result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
|
||||
<result column="show_update_rule" jdbcType="BIT" property="showUpdateRule" />
|
||||
<result column="case_creator" jdbcType="BIT" property="caseCreator" />
|
||||
<result column="scenario_creator" jdbcType="BIT" property="scenarioCreator" />
|
||||
<result column="sync_case" jdbcType="BIT" property="syncCase" />
|
||||
<result column="send_notice" jdbcType="BIT" property="sendNotice" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
<result column="api_sync_case_request" jdbcType="LONGVARCHAR" property="apiSyncCaseRequest" />
|
||||
</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, resource_id, resource_type, show_update_rule, case_creator, scenario_creator,
|
||||
sync_case, send_notice
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
api_sync_case_request
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiSyncRuleRelationExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from api_sync_rule_relation
|
||||
<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.ApiSyncRuleRelationExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from api_sync_rule_relation
|
||||
<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 api_sync_rule_relation
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from api_sync_rule_relation
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiSyncRuleRelationExample">
|
||||
delete from api_sync_rule_relation
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
insert into api_sync_rule_relation (id, resource_id, resource_type,
|
||||
show_update_rule, case_creator, scenario_creator,
|
||||
sync_case, send_notice, api_sync_case_request
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR}, #{resourceType,jdbcType=VARCHAR},
|
||||
#{showUpdateRule,jdbcType=BIT}, #{caseCreator,jdbcType=BIT}, #{scenarioCreator,jdbcType=BIT},
|
||||
#{syncCase,jdbcType=BIT}, #{sendNotice,jdbcType=BIT}, #{apiSyncCaseRequest,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
insert into api_sync_rule_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
resource_id,
|
||||
</if>
|
||||
<if test="resourceType != null">
|
||||
resource_type,
|
||||
</if>
|
||||
<if test="showUpdateRule != null">
|
||||
show_update_rule,
|
||||
</if>
|
||||
<if test="caseCreator != null">
|
||||
case_creator,
|
||||
</if>
|
||||
<if test="scenarioCreator != null">
|
||||
scenario_creator,
|
||||
</if>
|
||||
<if test="syncCase != null">
|
||||
sync_case,
|
||||
</if>
|
||||
<if test="sendNotice != null">
|
||||
send_notice,
|
||||
</if>
|
||||
<if test="apiSyncCaseRequest != null">
|
||||
api_sync_case_request,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
#{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="resourceType != null">
|
||||
#{resourceType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="showUpdateRule != null">
|
||||
#{showUpdateRule,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="caseCreator != null">
|
||||
#{caseCreator,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="scenarioCreator != null">
|
||||
#{scenarioCreator,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="syncCase != null">
|
||||
#{syncCase,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="sendNotice != null">
|
||||
#{sendNotice,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="apiSyncCaseRequest != null">
|
||||
#{apiSyncCaseRequest,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiSyncRuleRelationExample" resultType="java.lang.Long">
|
||||
select count(*) from api_sync_rule_relation
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update api_sync_rule_relation
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.resourceId != null">
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.resourceType != null">
|
||||
resource_type = #{record.resourceType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.showUpdateRule != null">
|
||||
show_update_rule = #{record.showUpdateRule,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.caseCreator != null">
|
||||
case_creator = #{record.caseCreator,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.scenarioCreator != null">
|
||||
scenario_creator = #{record.scenarioCreator,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.syncCase != null">
|
||||
sync_case = #{record.syncCase,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.sendNotice != null">
|
||||
send_notice = #{record.sendNotice,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.apiSyncCaseRequest != null">
|
||||
api_sync_case_request = #{record.apiSyncCaseRequest,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update api_sync_rule_relation
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
resource_type = #{record.resourceType,jdbcType=VARCHAR},
|
||||
show_update_rule = #{record.showUpdateRule,jdbcType=BIT},
|
||||
case_creator = #{record.caseCreator,jdbcType=BIT},
|
||||
scenario_creator = #{record.scenarioCreator,jdbcType=BIT},
|
||||
sync_case = #{record.syncCase,jdbcType=BIT},
|
||||
send_notice = #{record.sendNotice,jdbcType=BIT},
|
||||
api_sync_case_request = #{record.apiSyncCaseRequest,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update api_sync_rule_relation
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
resource_type = #{record.resourceType,jdbcType=VARCHAR},
|
||||
show_update_rule = #{record.showUpdateRule,jdbcType=BIT},
|
||||
case_creator = #{record.caseCreator,jdbcType=BIT},
|
||||
scenario_creator = #{record.scenarioCreator,jdbcType=BIT},
|
||||
sync_case = #{record.syncCase,jdbcType=BIT},
|
||||
send_notice = #{record.sendNotice,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
update api_sync_rule_relation
|
||||
<set>
|
||||
<if test="resourceId != null">
|
||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="resourceType != null">
|
||||
resource_type = #{resourceType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="showUpdateRule != null">
|
||||
show_update_rule = #{showUpdateRule,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="caseCreator != null">
|
||||
case_creator = #{caseCreator,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="scenarioCreator != null">
|
||||
scenario_creator = #{scenarioCreator,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="syncCase != null">
|
||||
sync_case = #{syncCase,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="sendNotice != null">
|
||||
send_notice = #{sendNotice,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="apiSyncCaseRequest != null">
|
||||
api_sync_case_request = #{apiSyncCaseRequest,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
update api_sync_rule_relation
|
||||
set resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
resource_type = #{resourceType,jdbcType=VARCHAR},
|
||||
show_update_rule = #{showUpdateRule,jdbcType=BIT},
|
||||
case_creator = #{caseCreator,jdbcType=BIT},
|
||||
scenario_creator = #{scenarioCreator,jdbcType=BIT},
|
||||
sync_case = #{syncCase,jdbcType=BIT},
|
||||
send_notice = #{sendNotice,jdbcType=BIT},
|
||||
api_sync_case_request = #{apiSyncCaseRequest,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiSyncRuleRelation">
|
||||
update api_sync_rule_relation
|
||||
set resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
resource_type = #{resourceType,jdbcType=VARCHAR},
|
||||
show_update_rule = #{showUpdateRule,jdbcType=BIT},
|
||||
case_creator = #{caseCreator,jdbcType=BIT},
|
||||
scenario_creator = #{scenarioCreator,jdbcType=BIT},
|
||||
sync_case = #{syncCase,jdbcType=BIT},
|
||||
send_notice = #{sendNotice,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -82,5 +82,9 @@ public enum ProjectApplicationType {
|
|||
/**
|
||||
* 我的工作台-触发待更新规则
|
||||
*/
|
||||
TRIGGER_UPDATE
|
||||
TRIGGER_UPDATE,
|
||||
/**
|
||||
* 我的工作台-开启待更新规则
|
||||
*/
|
||||
OPEN_UPDATE_RULE
|
||||
}
|
||||
|
|
|
@ -29,4 +29,5 @@ public class ProjectConfig {
|
|||
private String triggerUpdate;
|
||||
private Boolean openUpdateTime = false;
|
||||
private String openUpdateRuleTime;
|
||||
private Boolean openUpdateRule = false;
|
||||
}
|
||||
|
|
|
@ -63,52 +63,12 @@
|
|||
</javaClientGenerator>
|
||||
|
||||
<!--要生成的数据库表 -->
|
||||
<table tableName="api_sync_rule_relation"/>
|
||||
|
||||
<!--<table tableName="test_plan_test_case"/>-->
|
||||
<!--<table tableName="swagger_url_project"/>
|
||||
<table tableName="user_header"/>-->
|
||||
<!--<table tableName="test_plan"/>-->
|
||||
<!--<table tableName="test_plan"/>-->
|
||||
<!--<table tableName="api_scenario_report"/>-->
|
||||
<!--<table tableName="test_case_review"/>-->
|
||||
<!-- <table tableName="project">-->
|
||||
<!-- <ignoreColumn column="custom_num"/>-->
|
||||
<!-- <ignoreColumn column="scenario_custom_num"/>-->
|
||||
<!-- <ignoreColumn column="mock_tcp_port"/>-->
|
||||
<!-- <ignoreColumn column="is_mock_tcp_open"/>-->
|
||||
<!-- <ignoreColumn column="api_quick"/>-->
|
||||
<!-- <ignoreColumn column="case_public"/>-->
|
||||
<!-- <ignoreColumn column="clean_track_report"/>-->
|
||||
<!-- <ignoreColumn column="clean_track_report_expr"/>-->
|
||||
<!-- <ignoreColumn column="clean_api_report"/>-->
|
||||
<!-- <ignoreColumn column="clean_api_report_expr"/>-->
|
||||
<!-- <ignoreColumn column="clean_load_report"/>-->
|
||||
<!-- <ignoreColumn column="clean_load_report_expr"/>-->
|
||||
<!-- <ignoreColumn column="repeatable"/>-->
|
||||
<!-- </table>-->
|
||||
<table tableName="test_plan_report_content"/>
|
||||
<!-- <table tableName="scenario_execution_info"/>-->
|
||||
<!--<table tableName="enterprise_test_report_send_record"/>-->
|
||||
<!--<table tableName="test_case_review_api_case"/>
|
||||
<table tableName="test_case_review_load"/>
|
||||
<table tableName="test_case_review_scenario"/>
|
||||
<table tableName="test_plan"/>
|
||||
<table tableName="test_case_test"/>-->
|
||||
<!-- <table tableName="api_test_environment"></table>-->
|
||||
<!-- 要忽略的字段-->
|
||||
<!-- <table tableName="test_case">
|
||||
<ignoreColumn column="follow_people"/>
|
||||
</table>-->
|
||||
<!-- <table tableName="custom_field"></table>-->
|
||||
<!-- <table tableName="test_case"></table>-->
|
||||
<!-- <table tableName="test_case"></table>-->
|
||||
<!-- <table tableName="test_case"></table>-->
|
||||
<!-- <table tableName="api_test_case"></table>-->
|
||||
<!-- <table tableName="api_definition"></table>-->
|
||||
<!-- <table tableName="api_scenario"></table>
|
||||
<table tableName="test_case"></table>
|
||||
<table tableName="api_test_case"></table>
|
||||
<table tableName="api_definition"></table>-->
|
||||
|
||||
|
||||
<!-- 表名和关键字冲突-->
|
||||
<!-- <table tableName="group" delimitIdentifiers="true"></table>-->
|
||||
|
|
|
@ -20,15 +20,30 @@
|
|||
:project-id="projectId"
|
||||
:is-read-only="isReadOnly"
|
||||
:useEnvironment='useEnvironment'
|
||||
@setEnvironment="setEnvironment" ref="environmentSelect" v-if="api.protocol==='HTTP' || api.protocol ==='TCP'"/>
|
||||
@setEnvironment="setEnvironment" ref="environmentSelect"
|
||||
v-if="api.protocol==='HTTP' || api.protocol ==='TCP'"/>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<!-- 保存操作 -->
|
||||
<el-button type="primary" size="small" @click="saveTestCase()"
|
||||
<el-button v-if="!isXpack || !showUpdateRule"
|
||||
type="primary" size="small"
|
||||
@click="saveTestCase()"
|
||||
v-prevent-re-click
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
|
||||
{{ saveButtonText }}
|
||||
</el-button>
|
||||
<el-dropdown v-else
|
||||
style="margin-left: -15px"
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']"
|
||||
split-button type="primary" size="small" @click="saveTestCase" @command="handleCommand">
|
||||
{{ $t('commons.save') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="openSyncRule">{{
|
||||
$t('commons.save') + '&' + $t('workstation.sync_setting')
|
||||
}}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
@ -43,7 +58,7 @@ import MsTag from "../../../../common/components/MsTag";
|
|||
import MsEnvironmentSelect from "./MsEnvironmentSelect";
|
||||
import {API_METHOD_COLOUR} from "../../model/JsonData";
|
||||
import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem";
|
||||
import {hasPermission} from "@/common/js/utils";
|
||||
import {hasLicense, hasPermission} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiCaseHeader",
|
||||
|
@ -52,6 +67,8 @@ export default {
|
|||
return {
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
saveButtonText: this.$t('commons.save'),
|
||||
isXpack: false,
|
||||
showUpdateRule: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -80,8 +97,15 @@ export default {
|
|||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('keydown', this.keyDown) // 在页面销毁的时候记得解除
|
||||
this.$EventBus.$off('showXpackCaseBtn');
|
||||
},
|
||||
created() {
|
||||
this.isXpack = !!hasLicense();
|
||||
if (this.isXpack) {
|
||||
this.$EventBus.$on('showXpackCaseBtn', showUpdateRule => {
|
||||
this.handleXpackCaseBtnChange(showUpdateRule);
|
||||
});
|
||||
}
|
||||
if (this.buttonText) {
|
||||
this.saveButtonText = this.buttonText;
|
||||
}
|
||||
|
@ -104,7 +128,6 @@ export default {
|
|||
this.$emit('setEnvironment', data.id);
|
||||
}
|
||||
},
|
||||
|
||||
open() {
|
||||
this.$refs.searchBar.open();
|
||||
},
|
||||
|
@ -119,6 +142,15 @@ export default {
|
|||
},
|
||||
saveTestCase() {
|
||||
this.$emit("saveCase")
|
||||
},
|
||||
handleCommand(command) {
|
||||
if (command === 'openSyncRule') {
|
||||
this.$EventBus.$emit('showXpackCaseSet', false);
|
||||
this.saveTestCase();
|
||||
}
|
||||
},
|
||||
handleXpackCaseBtnChange(showUpdateRule) {
|
||||
this.showUpdateRule = showUpdateRule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,13 +176,59 @@
|
|||
</div>
|
||||
</el-collapse-transition>
|
||||
<ms-change-history ref="changeHistory"/>
|
||||
<el-dialog :visible.sync="syncCaseVisible" :append-to-body="true"
|
||||
:title="$t('commons.save')+'&'+$t('workstation.sync_setting')" v-if="isXpack">
|
||||
|
||||
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
|
||||
<span style="padding-left: 10px;">
|
||||
{{ $t('project_application.workstation.update_case_tip') }}
|
||||
<el-tooltip class="ms-num" effect="dark"
|
||||
:content="$t('project_application.workstation.case_receiver_tip')"
|
||||
placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<p
|
||||
style="font-size: 12px;color: var(--primary_color);margin-bottom: 20px;text-decoration:underline;cursor: pointer; padding-left: 10px;"
|
||||
@click="gotoApiMessage">
|
||||
{{ $t('project_application.workstation.go_to_case_message') }}
|
||||
</p>
|
||||
<el-row style="margin-bottom: 5px;margin-top: 5px">
|
||||
<el-col :span="4"><span
|
||||
style="font-weight: bold;padding-left: 10px;">{{ $t('api_test.definition.recipient') + ":" }}</span>
|
||||
</el-col>
|
||||
<el-col :span="20" style="color: var(--primary_color)">
|
||||
<el-checkbox v-model="caseSyncRuleRelation.scenarioCreator">
|
||||
{{ $t('commons.scenario') + $t('api_test.creator') }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-checkbox v-model="caseSyncRuleRelation.showUpdateRule" style="padding-left: 10px;">{{
|
||||
$t('project_application.workstation.no_show_setting')
|
||||
}}
|
||||
</el-checkbox>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="syncCaseVisible = false">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="saveCaseAndNotice()">{{ $t('commons.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {_getBodyUploadFiles, getCurrentProjectID, getCurrentUser, getUUID, hasPermission} from "@/common/js/utils";
|
||||
import {
|
||||
_getBodyUploadFiles,
|
||||
getCurrentProjectID,
|
||||
getCurrentUser,
|
||||
getUUID,
|
||||
hasLicense,
|
||||
hasPermission
|
||||
} from "@/common/js/utils";
|
||||
import {API_METHOD_COLOUR, API_STATUS, PRIORITY} from "../../model/JsonData";
|
||||
import MsTag from "../../../../common/components/MsTag";
|
||||
import MsTipButton from "../../../../common/components/MsTipButton";
|
||||
|
@ -201,6 +247,7 @@ import MsChangeHistory from "../../../../history/ChangeHistory";
|
|||
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
|
||||
import ApiCaseHeader from "./ApiCaseHeader";
|
||||
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
|
||||
import {deepClone} from "@/common/js/tableUtils";
|
||||
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const esbDefinition = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
|
||||
|
@ -263,11 +310,20 @@ export default {
|
|||
saveLoading: false,
|
||||
showFollow: false,
|
||||
beforeRequest: {},
|
||||
beforeUpdateRequest: {},
|
||||
compare: [],
|
||||
isSave: false,
|
||||
tagCount: 0,
|
||||
requestCount: 0,
|
||||
readonly: false
|
||||
readonly: false,
|
||||
noShowSyncRuleRelation: false,
|
||||
syncCaseVisible: false,
|
||||
readyToSaveCase: {},
|
||||
readyToHideAlert: false,
|
||||
caseSyncRuleRelation: {
|
||||
scenarioCreator: true,
|
||||
showUpdateRule: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -303,7 +359,10 @@ export default {
|
|||
return false;
|
||||
}
|
||||
},
|
||||
maintainerOptions: Array,
|
||||
maintainerOptions: Array
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$EventBus.$off('showXpackCaseSet');
|
||||
},
|
||||
created() {
|
||||
this.$store.state.scenarioEnvMap = undefined;
|
||||
|
@ -333,6 +392,13 @@ export default {
|
|||
if (this.currentApi && this.currentApi.request) {
|
||||
this.beforeRequest = JSON.parse(JSON.stringify(this.currentApi.request));
|
||||
}
|
||||
if (hasLicense()) {
|
||||
this.beforeUpdateRequest = deepClone(this.apiCase.request);
|
||||
this.getSyncRule();
|
||||
this.$EventBus.$on('showXpackCaseSet', noShowSyncRuleRelation => {
|
||||
this.handleXpackCaseSetChange(noShowSyncRuleRelation);
|
||||
});
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
watch: {
|
||||
|
@ -366,6 +432,11 @@ export default {
|
|||
this.saveStatus();
|
||||
}
|
||||
}
|
||||
},
|
||||
'caseSyncRuleRelation.showUpdateRule': {
|
||||
handler(v) {
|
||||
this.$EventBus.$emit('showXpackCaseBtn', v);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -614,19 +685,77 @@ export default {
|
|||
return;
|
||||
}
|
||||
mergeRequestDocumentData(this.apiCase.request);
|
||||
this.compare = [];
|
||||
if (this.compare.indexOf(row.id) === -1) {
|
||||
this.compare.push(row.id);
|
||||
if (this.api.saved) {
|
||||
this.addModule(row);
|
||||
} else {
|
||||
this.api.source = "editCase";
|
||||
if (!this.isSave) {
|
||||
this.saveCase(row, hideAlert);
|
||||
if (hasLicense()) {
|
||||
this.readyToSaveCase = row;
|
||||
this.readyToHideAlert = hideAlert;
|
||||
this.syncCaseVisible = this.validCaseRestChange();
|
||||
}
|
||||
if (!this.syncCaseVisible) {
|
||||
this.compare = [];
|
||||
if (this.compare.indexOf(row.id) === -1) {
|
||||
this.compare.push(row.id);
|
||||
if (this.api.saved) {
|
||||
this.addModule(row);
|
||||
} else {
|
||||
this.api.source = "editCase";
|
||||
if (!this.isSave) {
|
||||
this.saveCase(row, hideAlert);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
validCaseRestChange() {
|
||||
let syncCaseVisible = false;
|
||||
if (this.apiCase.request.headers && this.beforeUpdateRequest.headers) {
|
||||
let submitRequestHeaders = JSON.stringify(this.apiCase.request.headers);
|
||||
let beforeRequestHeaders = JSON.stringify(this.beforeUpdateRequest.headers);
|
||||
if ((submitRequestHeaders !== beforeRequestHeaders) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiCase.request.arguments && this.beforeUpdateRequest.arguments) {
|
||||
let submitRequestQuery = JSON.stringify(this.apiCase.request.arguments);
|
||||
let beforeRequestQuery = JSON.stringify(this.beforeUpdateRequest.arguments);
|
||||
if ((submitRequestQuery !== beforeRequestQuery) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiCase.request.rest && this.beforeUpdateRequest.rest) {
|
||||
let submitRequestRest = JSON.stringify(this.apiCase.request.rest);
|
||||
let beforeRequestRest = JSON.stringify(this.beforeUpdateRequest.rest);
|
||||
if ((submitRequestRest !== beforeRequestRest) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiCase.request.body && this.beforeUpdateRequest.body) {
|
||||
let submitRequestBody = JSON.stringify(this.apiCase.request.body);
|
||||
let beforeRequestBody = JSON.stringify(this.beforeUpdateRequest.body);
|
||||
if ((submitRequestBody !== beforeRequestBody) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiCase.request.authManager && this.beforeUpdateRequest.authManager) {
|
||||
let submitRequestAuthManager = JSON.stringify(this.apiCase.request.authManager);
|
||||
let beforeRequestAuthManager = JSON.stringify(this.beforeUpdateRequest.authManager);
|
||||
if ((submitRequestAuthManager !== beforeRequestAuthManager) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiCase.request.hashTree && this.beforeUpdateRequest.hashTree) {
|
||||
let submitRequestHashTree = JSON.stringify(this.apiCase.request.hashTree);
|
||||
let beforeRequestHashTree = JSON.stringify(this.beforeUpdateRequest.hashTree);
|
||||
if ((submitRequestHashTree !== beforeRequestHashTree) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
}
|
||||
if (((this.apiCase.request.connectTimeout !== this.beforeUpdateRequest.connectTimeout) || (this.apiCase.request.responseTimeout !== this.beforeUpdateRequest.responseTimeout)
|
||||
|| (this.apiCase.request.followRedirects !== this.beforeUpdateRequest.followRedirects) || (this.apiCase.request.alias !== this.beforeUpdateRequest.alias)
|
||||
|| this.caseSyncRuleRelation.showUpdateRule === true) && !this.noShowSyncRuleRelation) {
|
||||
syncCaseVisible = true;
|
||||
}
|
||||
return syncCaseVisible;
|
||||
},
|
||||
showInput(row) {
|
||||
this.isShowInput = true;
|
||||
row.active = true;
|
||||
|
@ -694,6 +823,52 @@ export default {
|
|||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
gotoApiMessage() {
|
||||
let apiResolve = this.$router.resolve({
|
||||
name: 'MessageSettings'
|
||||
});
|
||||
window.open(apiResolve.href, '_blank');
|
||||
},
|
||||
saveCaseAndNotice() {
|
||||
if (hasLicense()) {
|
||||
this.caseSyncRuleRelation.resourceId = this.apiCase.id;
|
||||
this.caseSyncRuleRelation.resourceType = "CASE";
|
||||
this.saveCaseSyncRuleRelation(this.caseSyncRuleRelation);
|
||||
}
|
||||
},
|
||||
saveCaseSyncRuleRelation(caseSyncRuleRelation) {
|
||||
this.saveLoading = true;
|
||||
this.$post("/api/update/rule/relation/add/" + caseSyncRuleRelation.resourceId, caseSyncRuleRelation, () => {
|
||||
this.compare = [];
|
||||
if (this.compare.indexOf(this.readyToSaveCase.id) === -1) {
|
||||
this.compare.push(this.readyToSaveCase.id);
|
||||
if (this.api.saved) {
|
||||
this.addModule(this.readyToSaveCase);
|
||||
} else {
|
||||
this.api.source = "editCase";
|
||||
if (!this.isSave) {
|
||||
this.saveCase(this.readyToSaveCase, this.readyToHideAlert);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.syncCaseVisible = false;
|
||||
});
|
||||
},
|
||||
getSyncRule() {
|
||||
this.$get('/api/update/rule/relation/get/' + this.apiCase.id + '/CASE', response => {
|
||||
if (response.data) {
|
||||
this.caseSyncRuleRelation = response.data;
|
||||
if (this.caseSyncRuleRelation.scenarioCreator !== false) {
|
||||
this.caseSyncRuleRelation.scenarioCreator = true;
|
||||
}
|
||||
this.noShowSyncRuleRelation = this.caseSyncRuleRelation.showUpdateRule
|
||||
this.$EventBus.$emit('showXpackCaseBtn', this.caseSyncRuleRelation.showUpdateRule);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleXpackCaseSetChange(noShowSyncRuleRelation) {
|
||||
this.noShowSyncRuleRelation = noShowSyncRuleRelation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,21 @@
|
|||
:version-data="versionData"
|
||||
:current-id="httpForm.id"
|
||||
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s"
|
||||
<el-button v-if="!isXpack || !apiSyncRuleRelation.showUpdateRule" type="primary" size="small"
|
||||
@click="saveApi" title="ctrl + s"
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']">{{ $t('commons.save') }}
|
||||
</el-button>
|
||||
<el-dropdown v-else
|
||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']"
|
||||
split-button type="primary" size="small" @click="saveApi" @command="handleCommand">
|
||||
{{ $t('commons.save') }}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="openSyncRule">{{
|
||||
$t('commons.save') + '&' + $t('workstation.sync') + $t('commons.setting')
|
||||
}}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
|
@ -186,39 +198,67 @@
|
|||
:title="$t('commons.save')+'&'+$t('workstation.sync')+$t('commons.setting')" v-if="isXpack">
|
||||
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
|
||||
<div class="timeClass">
|
||||
<span style="font-size: 16px;font-weight: bold">{{ $t('api_test.definition.one_click_sync') + "case" }}</span>
|
||||
<el-switch v-model="syncCases"></el-switch>
|
||||
<span style="font-size: 16px;font-weight: bold;padding-left: 10px;">{{
|
||||
$t('api_test.definition.one_click_sync') + "case"
|
||||
}}</span>
|
||||
<el-switch v-model="apiSyncRuleRelation.syncCase" style="padding-right: 10px"></el-switch>
|
||||
</div>
|
||||
<br/>
|
||||
<span style="font-size: 12px">{{ $t('workstation.batch_sync_api_tips') }}</span><br/><br/>
|
||||
<span v-if="syncCases" style="font-size: 16px; font-weight: bold">
|
||||
<span style="font-size: 12px;padding-left: 10px;">{{ $t('workstation.batch_sync_api_tips') }}</span><br/><br/>
|
||||
<span v-if="apiSyncRuleRelation.syncCase" style="font-size: 16px; font-weight: bold;padding-left: 10px;">
|
||||
{{ $t('workstation.sync') + $t('commons.setting') }}
|
||||
<i class="el-icon-arrow-down" v-if="showApiSyncConfig" @click="showApiSyncConfig=false"/>
|
||||
<i class="el-icon-arrow-right" v-if="!showApiSyncConfig" @click="showApiSyncConfig=true"/>
|
||||
</span><br/><br/>
|
||||
<div v-if="showApiSyncConfig">
|
||||
<sync-setting style="padding-left: 10px" v-if="syncCases" ref="synSetting"></sync-setting>
|
||||
<sync-setting style="padding-left: 20px" v-if="apiSyncRuleRelation.syncCase"
|
||||
v-bind:sync-data="apiSyncRuleRelation.apiSyncConfig"
|
||||
ref="synSetting" @updateSyncData="updateSyncData"></sync-setting>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)" v-if="showNotice">
|
||||
<el-row style="margin-bottom: 10px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
|
||||
<div class="timeClass">
|
||||
<span style="font-size: 16px;font-weight: bold">{{ $t('api_test.definition.change_notification') }}</span>
|
||||
<el-switch v-model="specialReceivers"></el-switch>
|
||||
<span style="font-size: 16px;font-weight: bold;padding-left: 10px;">
|
||||
{{ $t('api_test.definition.change_notification') }}
|
||||
<el-tooltip class="ms-num" effect="dark"
|
||||
:content="$t('project_application.workstation.api_receiver_tip')"
|
||||
placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<el-switch v-model="apiSyncRuleRelation.sendNotice" style="padding-right: 10px"></el-switch>
|
||||
</div>
|
||||
<span style="font-size: 12px;">
|
||||
<span style="font-size: 12px;padding-left: 10px;">
|
||||
{{ $t('api_test.definition.recipient_tips') }}
|
||||
</span>
|
||||
<el-row v-if="specialReceivers" style="margin-bottom: 5px;margin-top: 5px">
|
||||
</span><br/>
|
||||
<p
|
||||
style="font-size: 12px;color: var(--primary_color);margin-bottom: 20px;text-decoration:underline;cursor: pointer;padding-left: 10px;"
|
||||
@click="gotoApiMessage">
|
||||
{{ $t('project_application.workstation.go_to_api_message') }}
|
||||
</p>
|
||||
<el-row v-if="apiSyncRuleRelation.sendNotice" style="margin-bottom: 5px;margin-top: 5px">
|
||||
<el-col :span="4"><span
|
||||
style="font-weight: bold">{{ $t('api_test.definition.recipient') + ":" }}</span>
|
||||
style="font-weight: bold;padding-left: 10px;">{{ $t('api_test.definition.recipient') + ":" }}</span>
|
||||
</el-col>
|
||||
<el-col :span="20" style="color: #783887">
|
||||
<el-checkbox v-model="caseCreator">{{ 'CASE' + $t('api_test.creator') }}</el-checkbox>
|
||||
<el-checkbox v-model="scenarioCreator">{{ $t('commons.scenario') + $t('api_test.creator') }}</el-checkbox>
|
||||
<el-col :span="20" style="color: var(--primary_color)">
|
||||
<el-checkbox v-model="apiSyncRuleRelation.caseCreator">{{ 'CASE' + $t('api_test.creator') }}</el-checkbox>
|
||||
<el-checkbox v-model="apiSyncRuleRelation.scenarioCreator">
|
||||
{{ $t('commons.scenario') + $t('api_test.creator') }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-checkbox v-model="apiSyncRuleRelation.showUpdateRule" style="padding-left: 10px;">{{
|
||||
$t('project_application.workstation.no_show_setting')
|
||||
}}
|
||||
</el-checkbox>
|
||||
<el-tooltip class="ms-num" effect="dark"
|
||||
:content="$t('project_application.workstation.no_show_setting_tip')"
|
||||
placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="batchSyncApiVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="batchSync()">确 定</el-button>
|
||||
|
@ -319,14 +359,18 @@ export default {
|
|||
newResponse: {},
|
||||
createNewVersionVisible: false,
|
||||
batchSyncApiVisible: false,
|
||||
syncCases: true,
|
||||
specialReceivers: true,
|
||||
caseCreator: true,
|
||||
scenarioCreator: true,
|
||||
apiSyncCaseRequest: {},
|
||||
isXpack: false,
|
||||
showNotice: false,
|
||||
showApiSyncConfig: true
|
||||
showApiSyncConfig: true,
|
||||
apiSyncRuleRelation: {
|
||||
caseCreator: true,
|
||||
scenarioCreator: true,
|
||||
showUpdateRule: false,
|
||||
apiSyncCaseRequest: '',
|
||||
apiSyncConfig: {},
|
||||
syncCase: true,
|
||||
sendNotice: true,
|
||||
},
|
||||
noShowSyncRuleRelation: false
|
||||
};
|
||||
},
|
||||
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}, syncTabs: Array, projectId: String},
|
||||
|
@ -407,6 +451,11 @@ export default {
|
|||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
batchSyncApiVisible() {
|
||||
if (!this.batchSyncApiVisible && this.apiSyncRuleRelation.showUpdateRule) {
|
||||
this.noShowSyncRuleRelation = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -535,52 +584,42 @@ export default {
|
|||
}
|
||||
}
|
||||
if (hasLicense() && this.httpForm.caseTotal > 0 && !this.httpForm.isCopy) {
|
||||
|
||||
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.method) {
|
||||
if (this.httpForm.method !== this.beforeHttpForm.method) {
|
||||
if ((this.httpForm.method !== this.beforeHttpForm.method) && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
if ((this.httpForm.path !== this.beforeHttpForm.path) && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
if (this.request.headers && this.beforeRequest.headers) {
|
||||
let submitRequestHeaders = JSON.stringify(this.request.headers);
|
||||
let beforeRequestHeaders = JSON.stringify(this.beforeRequest.headers);
|
||||
if ((submitRequestHeaders !== beforeRequestHeaders) && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.path) {
|
||||
if (this.httpForm.path !== this.beforeHttpForm.path) {
|
||||
if (this.request.arguments && this.beforeRequest.arguments) {
|
||||
let submitRequestQuery = JSON.stringify(this.request.arguments);
|
||||
let beforeRequestQuery = JSON.stringify(this.beforeRequest.arguments);
|
||||
if ((submitRequestQuery !== beforeRequestQuery) && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.headers) {
|
||||
if (this.request.headers && this.beforeRequest.headers) {
|
||||
let submitRequestHeaders = JSON.stringify(this.request.headers);
|
||||
let beforeRequestHeaders = JSON.stringify(this.beforeRequest.headers);
|
||||
if (submitRequestHeaders !== beforeRequestHeaders) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
if (this.request.rest && this.beforeRequest.rest) {
|
||||
let submitRequestRest = JSON.stringify(this.request.rest);
|
||||
let beforeRequestRest = JSON.stringify(this.beforeRequest.rest);
|
||||
if ((submitRequestRest !== beforeRequestRest) && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.query) {
|
||||
if (this.request.arguments && this.beforeRequest.arguments) {
|
||||
let submitRequestQuery = JSON.stringify(this.request.arguments);
|
||||
let beforeRequestQuery = JSON.stringify(this.beforeRequest.arguments);
|
||||
if (submitRequestQuery !== beforeRequestQuery) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
if (this.request.body && this.beforeRequest.body) {
|
||||
let submitRequestBody = JSON.stringify(this.request.body);
|
||||
let beforeRequestBody = JSON.stringify(this.beforeRequest.body);
|
||||
if ((submitRequestBody !== beforeRequestBody) && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.rest) {
|
||||
if (this.request.rest && this.beforeRequest.rest) {
|
||||
let submitRequestRest = JSON.stringify(this.request.rest);
|
||||
let beforeRequestRest = JSON.stringify(this.beforeRequest.rest);
|
||||
if (submitRequestRest !== beforeRequestRest) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.body) {
|
||||
if (this.request.body && this.beforeRequest.body) {
|
||||
let submitRequestBody = JSON.stringify(this.request.body);
|
||||
let beforeRequestBody = JSON.stringify(this.beforeRequest.body);
|
||||
if (submitRequestBody !== beforeRequestBody) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
}
|
||||
if (this.apiSyncRuleRelation.showUpdateRule === true && !this.noShowSyncRuleRelation) {
|
||||
this.batchSyncApiVisible = true;
|
||||
}
|
||||
if (this.batchSyncApiVisible !== true) {
|
||||
this.$emit('saveApi', this.httpForm);
|
||||
|
@ -603,27 +642,38 @@ export default {
|
|||
if (hasLicense() && this.httpForm.caseTotal > 0) {
|
||||
if (this.$refs.synSetting && this.$refs.synSetting.fromData) {
|
||||
let fromData = this.$refs.synSetting.fromData;
|
||||
fromData.method = true;
|
||||
fromData.path = true;
|
||||
fromData.protocol = true;
|
||||
this.httpForm.triggerUpdate = JSON.stringify(fromData);
|
||||
this.apiSyncRuleRelation.apiSyncCaseRequest = JSON.stringify(fromData);
|
||||
}
|
||||
if (this.specialReceivers && this.specialReceivers === true) {
|
||||
this.httpForm.sendSpecialMessage = this.specialReceivers;
|
||||
if (this.apiSyncRuleRelation.sendNotice && this.apiSyncRuleRelation.sendNotice === true) {
|
||||
this.httpForm.sendSpecialMessage = this.apiSyncRuleRelation.sendNotice;
|
||||
} else {
|
||||
this.httpForm.sendSpecialMessage = false
|
||||
}
|
||||
|
||||
if (this.caseCreator && this.caseCreator === true) {
|
||||
this.httpForm.caseCreator = this.caseCreator;
|
||||
if (this.apiSyncRuleRelation.caseCreator && this.apiSyncRuleRelation.caseCreator === true) {
|
||||
this.httpForm.caseCreator = this.apiSyncRuleRelation.caseCreator;
|
||||
} else {
|
||||
this.httpForm.caseCreator = false
|
||||
}
|
||||
if (this.scenarioCreator && this.scenarioCreator === true) {
|
||||
this.httpForm.scenarioCreator = this.scenarioCreator;
|
||||
if (this.apiSyncRuleRelation.scenarioCreator && this.apiSyncRuleRelation.scenarioCreator === true) {
|
||||
this.httpForm.scenarioCreator = this.apiSyncRuleRelation.scenarioCreator;
|
||||
} else {
|
||||
this.httpForm.scenarioCreator = false
|
||||
}
|
||||
this.$emit('saveApi', this.httpForm);
|
||||
this.apiSyncRuleRelation.resourceId = this.httpForm.id;
|
||||
this.apiSyncRuleRelation.resourceType = "API";
|
||||
this.saveApiSyncRuleRelation(this.apiSyncRuleRelation);
|
||||
}
|
||||
},
|
||||
saveApiSyncRuleRelation(apiSyncRuleRelation) {
|
||||
this.$post("/api/update/rule/relation/add/" + apiSyncRuleRelation.resourceId, apiSyncRuleRelation, () => {
|
||||
this.$emit('saveApi', this.httpForm);
|
||||
});
|
||||
},
|
||||
createModules() {
|
||||
this.$emit("createRootModelInTree");
|
||||
},
|
||||
|
@ -877,37 +927,48 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
getApplication() {
|
||||
this.$get('/project_application/get/config/' + this.projectId + "/TRIGGER_UPDATE", res => {
|
||||
if (res.data && res.data.triggerUpdate) {
|
||||
this.apiSyncCaseRequest = JSON.parse(res.data.triggerUpdate);
|
||||
gotoApiMessage() {
|
||||
let apiResolve = this.$router.resolve({
|
||||
name: 'MessageSettings'
|
||||
});
|
||||
window.open(apiResolve.href, '_blank');
|
||||
},
|
||||
getSyncRule() {
|
||||
this.$get('/api/update/rule/relation/get/' + this.httpForm.id + '/API', response => {
|
||||
if (response.data) {
|
||||
this.apiSyncRuleRelation = response.data;
|
||||
if (this.apiSyncRuleRelation.apiSyncCaseRequest) {
|
||||
this.apiSyncRuleRelation.apiSyncConfig = JSON.parse(this.apiSyncRuleRelation.apiSyncCaseRequest);
|
||||
}
|
||||
if (this.apiSyncRuleRelation.caseCreator === null || this.apiSyncRuleRelation.caseCreator === undefined) {
|
||||
this.apiSyncRuleRelation.caseCreator = true;
|
||||
}
|
||||
if (this.apiSyncRuleRelation.scenarioCreator === null || this.apiSyncRuleRelation.scenarioCreator === undefined) {
|
||||
this.apiSyncRuleRelation.scenarioCreator = true;
|
||||
}
|
||||
if (this.apiSyncRuleRelation.syncCase === null || this.apiSyncRuleRelation.syncCase === undefined) {
|
||||
this.apiSyncRuleRelation.syncCase = true;
|
||||
}
|
||||
if (this.apiSyncRuleRelation.sendNotice === null || this.apiSyncRuleRelation.sendNotice === undefined) {
|
||||
this.apiSyncRuleRelation.sendNotice = true;
|
||||
}
|
||||
this.noShowSyncRuleRelation = this.apiSyncRuleRelation.showUpdateRule
|
||||
}
|
||||
});
|
||||
},
|
||||
getMessageList() {
|
||||
let messageConfig = {
|
||||
userIds: [],
|
||||
taskType: 'API_DEFINITION_TASK',
|
||||
event: 'UPDATE',
|
||||
webhook: null,
|
||||
type: 'IN_SITE',
|
||||
identification: null,
|
||||
isSet: null,
|
||||
testId: null,
|
||||
createTime: null,
|
||||
template: null
|
||||
updateSyncData(value) {
|
||||
this.apiSyncRuleRelation.apiSyncConfig = value;
|
||||
},
|
||||
handleCommand(command) {
|
||||
if (command === 'openSyncRule') {
|
||||
this.noShowSyncRuleRelation = false;
|
||||
this.saveApi();
|
||||
}
|
||||
this.$post('/notice/search/message/tasks/' + this.projectId, messageConfig, response => {
|
||||
if (response.data && response.data.length > 0) {
|
||||
this.showNotice = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getMaintainerOptions();
|
||||
this.getApplication();
|
||||
this.isXpack = !!hasLicense();
|
||||
if (!this.basisData.environmentId) {
|
||||
this.basisData.environmentId = "";
|
||||
|
@ -916,9 +977,6 @@ export default {
|
|||
this.basisData.moduleId = this.moduleOptions[0].id;
|
||||
}
|
||||
this.httpForm = JSON.parse(JSON.stringify(this.basisData));
|
||||
this.beforeHttpForm = deepClone(this.basisData);
|
||||
this.beforeRequest = deepClone(this.request);
|
||||
this.beforeResponse = deepClone(this.response);
|
||||
|
||||
this.$get('/api/definition/follow/' + this.basisData.id, response => {
|
||||
this.httpForm.follows = response.data;
|
||||
|
@ -934,7 +992,14 @@ export default {
|
|||
|
||||
if (hasLicense()) {
|
||||
this.getVersionHistory();
|
||||
this.getMessageList();
|
||||
this.getSyncRule();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (hasLicense()) {
|
||||
this.beforeHttpForm = deepClone(this.basisData);
|
||||
this.beforeRequest = deepClone(this.request);
|
||||
this.beforeResponse = deepClone(this.response);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,31 +1,27 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="4">{{ $t('api_test.mock.base_info') + ":" }}</el-col>
|
||||
<el-col :span="20" style="color: #783887">
|
||||
<el-checkbox v-model="fromData.protocol" disabled>{{
|
||||
$t('api_report.request') + $t('api_test.request.protocol')
|
||||
<el-col :span="4">{{ $t('api_test.mock.req_param') + ":" }}</el-col>
|
||||
<el-col :span="20" style="color: var(--primary_color)">
|
||||
<el-checkbox v-model="fromData.headers" @change="changeEvent">{{ "Header" + '\xa0\xa0' }}</el-checkbox>
|
||||
<el-checkbox v-model="fromData.query" @change="changeEvent">{{
|
||||
$t('api_test.definition.request.query_param')
|
||||
}}
|
||||
</el-checkbox>
|
||||
<el-checkbox v-model="fromData.method" disabled>
|
||||
{{ $t('api_test.definition.document.request_method') + '\xa0\xa0\xa0\xa0\xa0' }}
|
||||
<el-checkbox v-model="fromData.rest" @change="changeEvent">{{
|
||||
$t('api_test.definition.request.rest_param')
|
||||
}}
|
||||
</el-checkbox>
|
||||
<el-checkbox v-model="fromData.path" disabled>{{ "URL" }}</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="4">{{ $t('api_test.mock.req_param') + ":" }}</el-col>
|
||||
<el-col :span="20" style="color: #783887">
|
||||
<el-checkbox v-model="fromData.headers">{{ "Header" + '\xa0\xa0' }}</el-checkbox>
|
||||
<el-checkbox v-model="fromData.query">{{ $t('api_test.definition.request.query_param') }}</el-checkbox>
|
||||
<el-checkbox v-model="fromData.rest">{{ $t('api_test.definition.request.rest_param') }}</el-checkbox>
|
||||
<el-checkbox v-model="fromData.body">{{ $t('api_test.request.body') }}</el-checkbox>
|
||||
<el-checkbox v-model="fromData.body" @change="changeEvent">{{ $t('api_test.request.body') }}</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="4">{{ $t('api_test.definition.request.other_config') + ":" }}</el-col>
|
||||
<el-col :span="20" style="color: #783887">
|
||||
<el-checkbox v-model="fromData.delNotSame">{{ $t('workstation.delNotSame') }}</el-checkbox>
|
||||
<el-col :span="20" style="color: var(--primary_color)">
|
||||
<el-checkbox v-model="fromData.delNotSame" @change="changeEvent">{{
|
||||
$t('workstation.delNotSame')
|
||||
}}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -34,20 +30,30 @@
|
|||
<script>
|
||||
export default {
|
||||
name: "SyncSetting",
|
||||
props: {
|
||||
syncData: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
method: true,
|
||||
path: true,
|
||||
headers: true,
|
||||
query: true,
|
||||
rest: true,
|
||||
body: true,
|
||||
delNotSame: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fromData: {
|
||||
protocol: true,
|
||||
method: true,
|
||||
path: true,
|
||||
headers: true,
|
||||
query: true,
|
||||
rest: true,
|
||||
body: true,
|
||||
delNotSame: true,
|
||||
runError: true,
|
||||
unRun: true,
|
||||
}
|
||||
fromData: this.syncData
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeEvent() {
|
||||
this.$emit('updateSyncData', this.fromData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,5 +57,10 @@ export default {
|
|||
name: 'editCompleteContainer',
|
||||
component: () => import('@/business/components/api/definition/ApiDefinition'),
|
||||
},
|
||||
{
|
||||
path: 'messagesettings',
|
||||
name: 'MessageSettings',
|
||||
component: () => import('@/business/components/project/notification/MessageSettings'),
|
||||
},
|
||||
]
|
||||
};
|
||||
|
|
|
@ -10,12 +10,15 @@
|
|||
</el-row>
|
||||
<el-row style="margin-top: 15px">
|
||||
<app-manage-item
|
||||
:title="$t('workstation.upcoming')+'-'+$t('commons.pending_upgrade')+$t('test_track.case.list')"
|
||||
:title="$t('workstation.custom_update_list_rule')"
|
||||
:show-btn="true"
|
||||
@clickBtn="openRuleSetting"
|
||||
:disabled-btn="disabledRuleBtn"
|
||||
v-if="isXpack">
|
||||
<template #append>
|
||||
<el-button type="text" @click="openRuleSetting">
|
||||
<el-switch v-model="openUpdateRule" @change="openRule">
|
||||
{{ $t('commons.setting') + $t('commons.rule') }}
|
||||
</el-button>
|
||||
</el-switch>
|
||||
</template>
|
||||
</app-manage-item>
|
||||
</el-row>
|
||||
|
@ -226,20 +229,7 @@
|
|||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<el-row>
|
||||
<el-col :span="4">{{ $t('api_test.mock.base_info') + ":" }}</el-col>
|
||||
<el-col :span="20" style="color: #783887">
|
||||
<el-checkbox v-model="apiSyncCaseRequest.protocol" disabled>{{
|
||||
$t('api_report.request') + $t('api_test.request.protocol')
|
||||
}}
|
||||
</el-checkbox>
|
||||
<el-checkbox v-model="apiSyncCaseRequest.method" disabled>
|
||||
{{ $t('api_test.definition.document.request_method') + '\xa0\xa0\xa0\xa0\xa0' }}
|
||||
</el-checkbox>
|
||||
<el-checkbox v-model="apiSyncCaseRequest.path" disabled>{{ "URL" }}</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-row style="margin-bottom: 20px">
|
||||
<el-col :span="4">{{ $t('api_test.mock.req_param') + ":" }}</el-col>
|
||||
<el-col :span="20" style="color: #783887">
|
||||
<el-checkbox v-model="apiSyncCaseRequest.headers">{{ "Header" + '\xa0\xa0' }}</el-checkbox>
|
||||
|
@ -254,20 +244,21 @@
|
|||
<el-checkbox v-model="apiSyncCaseRequest.body">{{ $t('api_test.request.body') }}</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- <span>{{ $t('commons.track') + $t('commons.setting') }}<el-tooltip class="ms-num" effect="dark"
|
||||
:content="$t('project_application.workstation.case_tip')"
|
||||
placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<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.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>-->
|
||||
|
||||
<span>{{ $t('commons.track') + $t('commons.setting') }}<el-tooltip class="ms-num" effect="dark"
|
||||
:content="$t('project_application.workstation.case_tip')"
|
||||
placement="top">
|
||||
<i class="el-icon-warning"/>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<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.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>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="showRuleSetting = false">取 消</el-button>
|
||||
|
@ -348,13 +339,16 @@ export default {
|
|||
openUpdateTime: false,
|
||||
openUpdateRuleTime: "",
|
||||
triggerUpdate: "",
|
||||
openUpdateRule: false,
|
||||
},
|
||||
showRuleSetting: false,
|
||||
showSyncTimeSetting: true,
|
||||
apiSyncCaseRequest: {},
|
||||
pastQuantity: '',
|
||||
pastUnit: '',
|
||||
showApiConfig: true
|
||||
showApiConfig: true,
|
||||
disabledRuleBtn: false,
|
||||
openUpdateRule: true
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -418,6 +412,13 @@ export default {
|
|||
}
|
||||
if (this.config.triggerUpdate) {
|
||||
this.apiSyncCaseRequest = JSON.parse(this.config.triggerUpdate);
|
||||
} else {
|
||||
if (!this.config.openUpdateRuleTime) {
|
||||
this.config.openUpdateTime = true;
|
||||
this.showSyncTimeSetting = true;
|
||||
this.pastUnit = 'D'
|
||||
this.pastQuantity = 3
|
||||
}
|
||||
}
|
||||
if (this.config.openUpdateRuleTime) {
|
||||
this.pastUnit = this.config.openUpdateRuleTime.substring(this.config.openUpdateRuleTime.length - 1);
|
||||
|
@ -426,12 +427,14 @@ export default {
|
|||
this.showSyncTimeSetting = true;
|
||||
}
|
||||
}
|
||||
this.openUpdateRule = this.config.openUpdateRule
|
||||
this.disabledRuleBtn = !this.openUpdateRule
|
||||
}
|
||||
});
|
||||
},
|
||||
openRuleSetting() {
|
||||
this.showRuleSetting = true;
|
||||
if (!this.apiSyncCaseRequest) {
|
||||
if (JSON.stringify(this.apiSyncCaseRequest) === '{}') {
|
||||
this.apiSyncCaseRequest = {
|
||||
protocol: true,
|
||||
method: true,
|
||||
|
@ -440,7 +443,7 @@ export default {
|
|||
query: true,
|
||||
rest: true,
|
||||
body: true,
|
||||
runError: false,
|
||||
runError: true,
|
||||
unRun: false
|
||||
}
|
||||
}
|
||||
|
@ -448,6 +451,17 @@ export default {
|
|||
this.apiSyncCaseRequest.method = true;
|
||||
this.apiSyncCaseRequest.path = true;
|
||||
},
|
||||
openRule() {
|
||||
let configs = [];
|
||||
configs.push({
|
||||
projectId: this.projectId,
|
||||
typeValue: this.openUpdateRule,
|
||||
type: 'OPEN_UPDATE_RULE'
|
||||
});
|
||||
let params = {configs};
|
||||
this.startSaveData(params)
|
||||
this.disabledRuleBtn = !this.disabledRuleBtn;
|
||||
},
|
||||
setSyncTime() {
|
||||
let configs = [];
|
||||
if (this.config.openUpdateTime) {
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
<el-col :span="prependSpan">
|
||||
<div class="item_prepend">
|
||||
<slot name="prepend">
|
||||
<span :class="titleClass">{{ title }}</span>
|
||||
<el-button v-if="showBtn" type="text" @click="clickBtn" :disabled="disabledBtn">
|
||||
{{ title }}
|
||||
</el-button>
|
||||
<span v-else :class="titleClass">{{ title }}</span>
|
||||
<span class="prepend_description">{{ description }}</span>
|
||||
</slot>
|
||||
</div>
|
||||
|
@ -56,6 +59,18 @@ export default {
|
|||
default() {
|
||||
return 12;
|
||||
}
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
disabledBtn: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -64,6 +79,11 @@ export default {
|
|||
return this.description ?
|
||||
['prepend_title'] : ['prepend_title', 'item_prepend_lh'];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickBtn() {
|
||||
this.$emit('clickBtn')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -491,6 +491,8 @@ export default {
|
|||
},
|
||||
workstation: {
|
||||
sync: 'Synchronize',
|
||||
sync_setting: 'Sync settings',
|
||||
custom_update_list_rule: 'Customize to-be-updated list rules',
|
||||
ignore: 'Ignore',
|
||||
past: 'past',
|
||||
api_change: 'Api Change',
|
||||
|
@ -3391,7 +3393,14 @@ export default {
|
|||
rule_tip: 'Set the to-be-updated rule, if it meets the selected conditions, it will enter the to-be-updated list',
|
||||
api_tip: 'Both the interface definition and the affected interface use cases will enter the to-be-updated list',
|
||||
case_tip: 'If the interface use case meets the conditions, it will enter the to-be-updated list',
|
||||
update_rule_title: 'Enter the to-be-updated list rule settings'
|
||||
update_rule_title: 'Enter the to-be-updated list rule settings',
|
||||
no_show_setting: 'No popup settings popup',
|
||||
api_receiver_tip: "Note: Please confirm that \"API update\" in the API test task notification has been set \"Intra-site message\" message, otherwise, you will not receive message reminders",
|
||||
case_receiver_tip: "Note: Please confirm that \"CASE update\" in the API test task notification has been set \"Intra-site message\" message, otherwise, you will not receive message reminders",
|
||||
no_show_setting_tip: "After checking, the pop-up window will no longer pop up, and the synchronization and change notification will be performed according to the setting content by default: If you need to change the setting, you can open the setting item in the drop-down option next to the save button。",
|
||||
go_to_api_message: 'Interface API update message notification',
|
||||
go_to_case_message: 'CASE update message notification',
|
||||
update_case_tip: 'When the CASE changes, the creator of the automation scene referring to the CASE recycles the message reminder in the station'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -494,6 +494,8 @@ export default {
|
|||
},
|
||||
workstation: {
|
||||
sync: '同步',
|
||||
sync_setting: '同步设置',
|
||||
custom_update_list_rule: '自定义待更新列表规则',
|
||||
ignore: '忽略',
|
||||
past: '过去',
|
||||
api_change: '接口变更',
|
||||
|
@ -3402,7 +3404,14 @@ export default {
|
|||
rule_tip: '设置待更新规则,符合选择的条件,会进入待更新列表中',
|
||||
api_tip: '接口定义和受影响的接口用例都会进入待更新列表',
|
||||
case_tip: '接口用例符合条件就会进入待更新列表',
|
||||
update_rule_title: '进入待更新列表规则设置'
|
||||
update_rule_title: '进入待更新列表规则设置',
|
||||
no_show_setting: '不在弹出设置弹窗',
|
||||
api_receiver_tip: "注意:请确认接口测试任务通知中的\"API更新\"已设置\"站内信\"消息,否则,将接收不到消息提醒。",
|
||||
case_receiver_tip: "注意:请确认接口测试任务通知中的\"CASE更新\"已设置\"站内信\"消息,否则,将接收不到消息提醒。",
|
||||
no_show_setting_tip: "勾选后,不再弹出弹窗,会默认按照设置的内容执行同步和变更通知:如果需要更改设置,可以在保存按钮旁的下拉选项中,打开设置项。",
|
||||
go_to_api_message: '接口API更新消息通知',
|
||||
go_to_case_message: 'CASE更新消息通知',
|
||||
update_case_tip: '当CASE发生变化时,引用CASE的自动化场景创建人回收到站内消息提醒'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -494,6 +494,8 @@ export default {
|
|||
},
|
||||
workstation: {
|
||||
sync: '同步',
|
||||
sync_setting: '同步設置',
|
||||
custom_update_list_rule: '自定義待更新列表規則',
|
||||
ignore: '忽略',
|
||||
past: '過去',
|
||||
api_change: '接口變更',
|
||||
|
@ -3378,7 +3380,14 @@ export default {
|
|||
rule_tip: '設置待更新規則,符合選擇的條件,會進入待更新列表中',
|
||||
api_tip: '接口定義和受影響的接口用例都會進入待更新列表',
|
||||
case_tip: '接口用例符合條件就會進入待更新列表',
|
||||
update_rule_title: '進入待更新列表規則設置'
|
||||
update_rule_title: '進入待更新列表規則設置',
|
||||
no_show_setting: '不在彈出設置彈窗',
|
||||
api_receiver_tip: "注意:請確認接口測試任務通知中的\"API更新\"已設置\"站內信\"消息,否則,將接收不到消息提醒",
|
||||
case_receiver_tip: "注意:請確認接口測試任務通知中的\"CASE更新\"已設置\"站內信\"消息,否則,將接收不到消息提醒。",
|
||||
no_show_setting_tip: "勾選後,不再彈出彈窗,會默認按照設置的內容執行同步和變更通知:如果需要更改設置,可以在保存按鈕旁的下拉選項中,打開設置項。",
|
||||
go_to_api_message: '接口API更新消息通知',
|
||||
go_to_case_message: 'CASE更新消息通知',
|
||||
update_case_tip: '當CASE發生變化時,引用CASE的自動化場景創建人回收到站內消息提醒'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue