refactor: 级联删除关注人

This commit is contained in:
CaptainB 2021-10-24 12:48:07 +08:00 committed by 刘瑞斌
parent 4a0a6f5269
commit e655c12a07
21 changed files with 2100 additions and 0 deletions

View File

@ -468,6 +468,12 @@ public class ApiAutomationService {
apiScenarioMapper.deleteByPrimaryKey(id);
}
private void deleteFollows(String id) {
ApiScenarioFollowExample example = new ApiScenarioFollowExample();
example.createCriteria().andScenarioIdEqualTo(id);
apiScenarioFollowMapper.deleteByExample(example);
}
public void preDelete(String scenarioId) {
//删除引用
apiScenarioReferenceIdService.deleteByScenarioId(scenarioId);
@ -495,6 +501,7 @@ public class ApiAutomationService {
// 删除引用关系
relationshipEdgeService.delete(scenarioId);
deleteBodyFileByScenarioId(scenarioId);
deleteFollows(scenarioId);
}
public void deleteBodyFileByScenarioId(String scenarioId) {
@ -552,6 +559,7 @@ public class ApiAutomationService {
}
scheduleService.deleteByResourceId(id, ScheduleGroup.API_SCENARIO_TEST.name());
deleteFollows(id);
}
if (!testPlanApiScenarioIdList.isEmpty()) {
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();

View File

@ -293,6 +293,13 @@ public class ApiDefinitionService {
mockConfigService.deleteMockConfigByApiId(apiId);
relationshipEdgeService.delete(apiId); // 删除关系图
FileUtils.deleteBodyFiles(apiId);
deleteFollows(apiId);
}
private void deleteFollows(String apiId) {
ApiDefinitionFollowExample example = new ApiDefinitionFollowExample();
example.createCriteria().andDefinitionIdEqualTo(apiId);
apiDefinitionFollowMapper.deleteByExample(example);
}
public void deleteBatch(List<String> apiIds) {
@ -305,6 +312,7 @@ public class ApiDefinitionService {
relationshipEdgeService.delete(apiIds); // 删除关系图
for (String apiId : apiIds) {
mockConfigService.deleteMockConfigByApiId(apiId);
deleteFollows(apiId);
}
}

View File

@ -249,6 +249,13 @@ public class ApiTestCaseService {
apiTestCaseMapper.deleteByPrimaryKey(testId);
esbApiParamService.deleteByResourceId(testId);
deleteBodyFiles(testId);
deleteFollows(testId);
}
private void deleteFollows(String testId) {
ApiTestCaseFollowExample example = new ApiTestCaseFollowExample();
example.createCriteria().andCaseIdEqualTo(testId);
apiTestCaseFollowMapper.deleteByExample(example);
}
public void deleteTestCase(String apiId) {
@ -472,6 +479,7 @@ public class ApiTestCaseService {
public void deleteBatch(List<String> ids) {
for (String testId : ids) {
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
deleteFollows(testId);
}
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(ids);

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiDefinitionFollow implements Serializable {
private String definitionId;
private String followId;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiDefinitionFollowExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiDefinitionFollowExample() {
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 andDefinitionIdIsNull() {
addCriterion("definition_id is null");
return (Criteria) this;
}
public Criteria andDefinitionIdIsNotNull() {
addCriterion("definition_id is not null");
return (Criteria) this;
}
public Criteria andDefinitionIdEqualTo(String value) {
addCriterion("definition_id =", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdNotEqualTo(String value) {
addCriterion("definition_id <>", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdGreaterThan(String value) {
addCriterion("definition_id >", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdGreaterThanOrEqualTo(String value) {
addCriterion("definition_id >=", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdLessThan(String value) {
addCriterion("definition_id <", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdLessThanOrEqualTo(String value) {
addCriterion("definition_id <=", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdLike(String value) {
addCriterion("definition_id like", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdNotLike(String value) {
addCriterion("definition_id not like", value, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdIn(List<String> values) {
addCriterion("definition_id in", values, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdNotIn(List<String> values) {
addCriterion("definition_id not in", values, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdBetween(String value1, String value2) {
addCriterion("definition_id between", value1, value2, "definitionId");
return (Criteria) this;
}
public Criteria andDefinitionIdNotBetween(String value1, String value2) {
addCriterion("definition_id not between", value1, value2, "definitionId");
return (Criteria) this;
}
public Criteria andFollowIdIsNull() {
addCriterion("follow_id is null");
return (Criteria) this;
}
public Criteria andFollowIdIsNotNull() {
addCriterion("follow_id is not null");
return (Criteria) this;
}
public Criteria andFollowIdEqualTo(String value) {
addCriterion("follow_id =", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotEqualTo(String value) {
addCriterion("follow_id <>", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThan(String value) {
addCriterion("follow_id >", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThanOrEqualTo(String value) {
addCriterion("follow_id >=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThan(String value) {
addCriterion("follow_id <", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThanOrEqualTo(String value) {
addCriterion("follow_id <=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLike(String value) {
addCriterion("follow_id like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotLike(String value) {
addCriterion("follow_id not like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdIn(List<String> values) {
addCriterion("follow_id in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotIn(List<String> values) {
addCriterion("follow_id not in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdBetween(String value1, String value2) {
addCriterion("follow_id between", value1, value2, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotBetween(String value1, String value2) {
addCriterion("follow_id not between", value1, value2, "followId");
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);
}
}
}

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiScenarioFollow implements Serializable {
private String scenarioId;
private String followId;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiScenarioFollowExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiScenarioFollowExample() {
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 andScenarioIdIsNull() {
addCriterion("scenario_id is null");
return (Criteria) this;
}
public Criteria andScenarioIdIsNotNull() {
addCriterion("scenario_id is not null");
return (Criteria) this;
}
public Criteria andScenarioIdEqualTo(String value) {
addCriterion("scenario_id =", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdNotEqualTo(String value) {
addCriterion("scenario_id <>", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdGreaterThan(String value) {
addCriterion("scenario_id >", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdGreaterThanOrEqualTo(String value) {
addCriterion("scenario_id >=", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdLessThan(String value) {
addCriterion("scenario_id <", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdLessThanOrEqualTo(String value) {
addCriterion("scenario_id <=", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdLike(String value) {
addCriterion("scenario_id like", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdNotLike(String value) {
addCriterion("scenario_id not like", value, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdIn(List<String> values) {
addCriterion("scenario_id in", values, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdNotIn(List<String> values) {
addCriterion("scenario_id not in", values, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdBetween(String value1, String value2) {
addCriterion("scenario_id between", value1, value2, "scenarioId");
return (Criteria) this;
}
public Criteria andScenarioIdNotBetween(String value1, String value2) {
addCriterion("scenario_id not between", value1, value2, "scenarioId");
return (Criteria) this;
}
public Criteria andFollowIdIsNull() {
addCriterion("follow_id is null");
return (Criteria) this;
}
public Criteria andFollowIdIsNotNull() {
addCriterion("follow_id is not null");
return (Criteria) this;
}
public Criteria andFollowIdEqualTo(String value) {
addCriterion("follow_id =", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotEqualTo(String value) {
addCriterion("follow_id <>", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThan(String value) {
addCriterion("follow_id >", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThanOrEqualTo(String value) {
addCriterion("follow_id >=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThan(String value) {
addCriterion("follow_id <", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThanOrEqualTo(String value) {
addCriterion("follow_id <=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLike(String value) {
addCriterion("follow_id like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotLike(String value) {
addCriterion("follow_id not like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdIn(List<String> values) {
addCriterion("follow_id in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotIn(List<String> values) {
addCriterion("follow_id not in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdBetween(String value1, String value2) {
addCriterion("follow_id between", value1, value2, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotBetween(String value1, String value2) {
addCriterion("follow_id not between", value1, value2, "followId");
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);
}
}
}

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiTestCaseFollow implements Serializable {
private String caseId;
private String followId;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiTestCaseFollowExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiTestCaseFollowExample() {
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 andCaseIdIsNull() {
addCriterion("case_id is null");
return (Criteria) this;
}
public Criteria andCaseIdIsNotNull() {
addCriterion("case_id is not null");
return (Criteria) this;
}
public Criteria andCaseIdEqualTo(String value) {
addCriterion("case_id =", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotEqualTo(String value) {
addCriterion("case_id <>", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdGreaterThan(String value) {
addCriterion("case_id >", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdGreaterThanOrEqualTo(String value) {
addCriterion("case_id >=", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLessThan(String value) {
addCriterion("case_id <", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLessThanOrEqualTo(String value) {
addCriterion("case_id <=", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLike(String value) {
addCriterion("case_id like", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotLike(String value) {
addCriterion("case_id not like", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdIn(List<String> values) {
addCriterion("case_id in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotIn(List<String> values) {
addCriterion("case_id not in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdBetween(String value1, String value2) {
addCriterion("case_id between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotBetween(String value1, String value2) {
addCriterion("case_id not between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andFollowIdIsNull() {
addCriterion("follow_id is null");
return (Criteria) this;
}
public Criteria andFollowIdIsNotNull() {
addCriterion("follow_id is not null");
return (Criteria) this;
}
public Criteria andFollowIdEqualTo(String value) {
addCriterion("follow_id =", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotEqualTo(String value) {
addCriterion("follow_id <>", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThan(String value) {
addCriterion("follow_id >", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThanOrEqualTo(String value) {
addCriterion("follow_id >=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThan(String value) {
addCriterion("follow_id <", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThanOrEqualTo(String value) {
addCriterion("follow_id <=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLike(String value) {
addCriterion("follow_id like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotLike(String value) {
addCriterion("follow_id not like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdIn(List<String> values) {
addCriterion("follow_id in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotIn(List<String> values) {
addCriterion("follow_id not in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdBetween(String value1, String value2) {
addCriterion("follow_id between", value1, value2, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotBetween(String value1, String value2) {
addCriterion("follow_id not between", value1, value2, "followId");
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);
}
}
}

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestCaseFollow implements Serializable {
private String caseId;
private String followId;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class TestCaseFollowExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TestCaseFollowExample() {
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 andCaseIdIsNull() {
addCriterion("case_id is null");
return (Criteria) this;
}
public Criteria andCaseIdIsNotNull() {
addCriterion("case_id is not null");
return (Criteria) this;
}
public Criteria andCaseIdEqualTo(String value) {
addCriterion("case_id =", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotEqualTo(String value) {
addCriterion("case_id <>", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdGreaterThan(String value) {
addCriterion("case_id >", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdGreaterThanOrEqualTo(String value) {
addCriterion("case_id >=", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLessThan(String value) {
addCriterion("case_id <", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLessThanOrEqualTo(String value) {
addCriterion("case_id <=", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdLike(String value) {
addCriterion("case_id like", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotLike(String value) {
addCriterion("case_id not like", value, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdIn(List<String> values) {
addCriterion("case_id in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotIn(List<String> values) {
addCriterion("case_id not in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdBetween(String value1, String value2) {
addCriterion("case_id between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotBetween(String value1, String value2) {
addCriterion("case_id not between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andFollowIdIsNull() {
addCriterion("follow_id is null");
return (Criteria) this;
}
public Criteria andFollowIdIsNotNull() {
addCriterion("follow_id is not null");
return (Criteria) this;
}
public Criteria andFollowIdEqualTo(String value) {
addCriterion("follow_id =", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotEqualTo(String value) {
addCriterion("follow_id <>", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThan(String value) {
addCriterion("follow_id >", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThanOrEqualTo(String value) {
addCriterion("follow_id >=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThan(String value) {
addCriterion("follow_id <", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThanOrEqualTo(String value) {
addCriterion("follow_id <=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLike(String value) {
addCriterion("follow_id like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotLike(String value) {
addCriterion("follow_id not like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdIn(List<String> values) {
addCriterion("follow_id in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotIn(List<String> values) {
addCriterion("follow_id not in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdBetween(String value1, String value2) {
addCriterion("follow_id between", value1, value2, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotBetween(String value1, String value2) {
addCriterion("follow_id not between", value1, value2, "followId");
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);
}
}
}

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiDefinitionFollow;
import io.metersphere.base.domain.ApiDefinitionFollowExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiDefinitionFollowMapper {
long countByExample(ApiDefinitionFollowExample example);
int deleteByExample(ApiDefinitionFollowExample example);
int insert(ApiDefinitionFollow record);
int insertSelective(ApiDefinitionFollow record);
List<ApiDefinitionFollow> selectByExample(ApiDefinitionFollowExample example);
int updateByExampleSelective(@Param("record") ApiDefinitionFollow record, @Param("example") ApiDefinitionFollowExample example);
int updateByExample(@Param("record") ApiDefinitionFollow record, @Param("example") ApiDefinitionFollowExample example);
}

View File

@ -0,0 +1,140 @@
<?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.ApiDefinitionFollowMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiDefinitionFollow">
<result column="definition_id" jdbcType="VARCHAR" property="definitionId" />
<result column="follow_id" jdbcType="VARCHAR" property="followId" />
</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">
definition_id, follow_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiDefinitionFollowExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_definition_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiDefinitionFollowExample">
delete from api_definition_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionFollow">
insert into api_definition_follow (definition_id, follow_id)
values (#{definitionId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionFollow">
insert into api_definition_follow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="definitionId != null">
definition_id,
</if>
<if test="followId != null">
follow_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="definitionId != null">
#{definitionId,jdbcType=VARCHAR},
</if>
<if test="followId != null">
#{followId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiDefinitionFollowExample" resultType="java.lang.Long">
select count(*) from api_definition_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_definition_follow
<set>
<if test="record.definitionId != null">
definition_id = #{record.definitionId,jdbcType=VARCHAR},
</if>
<if test="record.followId != null">
follow_id = #{record.followId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_definition_follow
set definition_id = #{record.definitionId,jdbcType=VARCHAR},
follow_id = #{record.followId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiScenarioFollow;
import io.metersphere.base.domain.ApiScenarioFollowExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiScenarioFollowMapper {
long countByExample(ApiScenarioFollowExample example);
int deleteByExample(ApiScenarioFollowExample example);
int insert(ApiScenarioFollow record);
int insertSelective(ApiScenarioFollow record);
List<ApiScenarioFollow> selectByExample(ApiScenarioFollowExample example);
int updateByExampleSelective(@Param("record") ApiScenarioFollow record, @Param("example") ApiScenarioFollowExample example);
int updateByExample(@Param("record") ApiScenarioFollow record, @Param("example") ApiScenarioFollowExample example);
}

View File

@ -0,0 +1,140 @@
<?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.ApiScenarioFollowMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiScenarioFollow">
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
<result column="follow_id" jdbcType="VARCHAR" property="followId" />
</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">
scenario_id, follow_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiScenarioFollowExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_scenario_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiScenarioFollowExample">
delete from api_scenario_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiScenarioFollow">
insert into api_scenario_follow (scenario_id, follow_id)
values (#{scenarioId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioFollow">
insert into api_scenario_follow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="scenarioId != null">
scenario_id,
</if>
<if test="followId != null">
follow_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="scenarioId != null">
#{scenarioId,jdbcType=VARCHAR},
</if>
<if test="followId != null">
#{followId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiScenarioFollowExample" resultType="java.lang.Long">
select count(*) from api_scenario_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_scenario_follow
<set>
<if test="record.scenarioId != null">
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
</if>
<if test="record.followId != null">
follow_id = #{record.followId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_scenario_follow
set scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
follow_id = #{record.followId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiTestCaseFollow;
import io.metersphere.base.domain.ApiTestCaseFollowExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiTestCaseFollowMapper {
long countByExample(ApiTestCaseFollowExample example);
int deleteByExample(ApiTestCaseFollowExample example);
int insert(ApiTestCaseFollow record);
int insertSelective(ApiTestCaseFollow record);
List<ApiTestCaseFollow> selectByExample(ApiTestCaseFollowExample example);
int updateByExampleSelective(@Param("record") ApiTestCaseFollow record, @Param("example") ApiTestCaseFollowExample example);
int updateByExample(@Param("record") ApiTestCaseFollow record, @Param("example") ApiTestCaseFollowExample example);
}

View File

@ -0,0 +1,140 @@
<?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.ApiTestCaseFollowMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestCaseFollow">
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
<result column="follow_id" jdbcType="VARCHAR" property="followId" />
</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">
case_id, follow_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestCaseFollowExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from api_test_case_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestCaseFollowExample">
delete from api_test_case_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestCaseFollow">
insert into api_test_case_follow (case_id, follow_id)
values (#{caseId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseFollow">
insert into api_test_case_follow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="caseId != null">
case_id,
</if>
<if test="followId != null">
follow_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseId != null">
#{caseId,jdbcType=VARCHAR},
</if>
<if test="followId != null">
#{followId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestCaseFollowExample" resultType="java.lang.Long">
select count(*) from api_test_case_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update api_test_case_follow
<set>
<if test="record.caseId != null">
case_id = #{record.caseId,jdbcType=VARCHAR},
</if>
<if test="record.followId != null">
follow_id = #{record.followId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update api_test_case_follow
set case_id = #{record.caseId,jdbcType=VARCHAR},
follow_id = #{record.followId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseFollow;
import io.metersphere.base.domain.TestCaseFollowExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestCaseFollowMapper {
long countByExample(TestCaseFollowExample example);
int deleteByExample(TestCaseFollowExample example);
int insert(TestCaseFollow record);
int insertSelective(TestCaseFollow record);
List<TestCaseFollow> selectByExample(TestCaseFollowExample example);
int updateByExampleSelective(@Param("record") TestCaseFollow record, @Param("example") TestCaseFollowExample example);
int updateByExample(@Param("record") TestCaseFollow record, @Param("example") TestCaseFollowExample example);
}

View File

@ -0,0 +1,140 @@
<?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.TestCaseFollowMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseFollow">
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
<result column="follow_id" jdbcType="VARCHAR" property="followId" />
</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">
case_id, follow_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseFollowExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_case_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseFollowExample">
delete from test_case_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseFollow">
insert into test_case_follow (case_id, follow_id)
values (#{caseId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseFollow">
insert into test_case_follow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="caseId != null">
case_id,
</if>
<if test="followId != null">
follow_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseId != null">
#{caseId,jdbcType=VARCHAR},
</if>
<if test="followId != null">
#{followId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseFollowExample" resultType="java.lang.Long">
select count(*) from test_case_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case_follow
<set>
<if test="record.caseId != null">
case_id = #{record.caseId,jdbcType=VARCHAR},
</if>
<if test="record.followId != null">
follow_id = #{record.followId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_follow
set case_id = #{record.caseId,jdbcType=VARCHAR},
follow_id = #{record.followId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -146,6 +146,14 @@ public class PerformanceTestService {
testPlanLoadCaseService.deleteByTestId(testId);
detachFileByTestId(request.getId());
deleteFollows(request.getId());
}
private void deleteFollows(String testId) {
LoadTestFollowExample example = new LoadTestFollowExample();
example.createCriteria().andTestIdEqualTo(testId);
loadTestFollowMapper.deleteByExample(example);
}
public void detachFileByTestId(String testId) {

View File

@ -346,9 +346,16 @@ public class TestCaseService {
testCaseTestMapper.deleteByExample(examples);
relateDelete(testCaseId);
relationshipEdgeService.delete(testCaseId); // 删除关系图
deleteFollows(testCaseId);
return testCaseMapper.deleteByPrimaryKey(testCaseId);
}
private void deleteFollows(String testCaseId) {
TestCaseFollowExample example = new TestCaseFollowExample();
example.createCriteria().andCaseIdEqualTo(testCaseId);
testCaseFollowMapper.deleteByExample(example);
}
public int deleteTestCaseToGc(String testCaseId) {
TestCase testCase = new TestCase();
testCase.setId(testCaseId);
@ -1267,6 +1274,7 @@ public class TestCaseService {
examples.createCriteria().andTestCaseIdEqualTo(testCaseId);
testCaseTestMapper.deleteByExample(examples);
relateDelete(testCaseId);
deleteFollows(testCaseId);
});
testCaseMapper.deleteByExample(example);