From 201bdb2747cba1c21304efc8fb44673c8e30df8f Mon Sep 17 00:00:00 2001 From: CaptainB Date: Sun, 24 Oct 2021 12:48:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BA=A7=E8=81=94=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=85=B3=E6=B3=A8=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 8 + .../api/service/ApiDefinitionService.java | 8 + .../api/service/ApiTestCaseService.java | 8 + .../base/domain/ApiDefinitionFollow.java | 13 + .../domain/ApiDefinitionFollowExample.java | 340 ++++++++++++++++++ .../base/domain/ApiScenarioFollow.java | 13 + .../base/domain/ApiScenarioFollowExample.java | 340 ++++++++++++++++++ .../base/domain/ApiTestCaseFollow.java | 13 + .../base/domain/ApiTestCaseFollowExample.java | 340 ++++++++++++++++++ .../base/domain/TestCaseFollow.java | 13 + .../base/domain/TestCaseFollowExample.java | 340 ++++++++++++++++++ .../mapper/ApiDefinitionFollowMapper.java | 22 ++ .../base/mapper/ApiDefinitionFollowMapper.xml | 140 ++++++++ .../base/mapper/ApiScenarioFollowMapper.java | 22 ++ .../base/mapper/ApiScenarioFollowMapper.xml | 140 ++++++++ .../base/mapper/ApiTestCaseFollowMapper.java | 22 ++ .../base/mapper/ApiTestCaseFollowMapper.xml | 140 ++++++++ .../base/mapper/TestCaseFollowMapper.java | 22 ++ .../base/mapper/TestCaseFollowMapper.xml | 140 ++++++++ .../service/PerformanceTestService.java | 8 + .../track/service/TestCaseService.java | 8 + 21 files changed, 2100 insertions(+) create mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollow.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollowExample.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollow.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollowExample.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollow.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollowExample.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/TestCaseFollow.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/TestCaseFollowExample.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.xml create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.xml create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.xml create mode 100644 backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.xml diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 7547a6e3a3..81c0655226 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -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(); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 89bc358b02..75c1e04d65 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -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 apiIds) { @@ -305,6 +312,7 @@ public class ApiDefinitionService { relationshipEdgeService.delete(apiIds); // 删除关系图 for (String apiId : apiIds) { mockConfigService.deleteMockConfigByApiId(apiId); + deleteFollows(apiId); } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 99d6723a6b..d3678cff9e 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -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 ids) { for (String testId : ids) { extTestPlanTestCaseMapper.deleteByTestCaseID(testId); + deleteFollows(testId); } ApiTestCaseExample example = new ApiTestCaseExample(); example.createCriteria().andIdIn(ids); diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollow.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollow.java new file mode 100644 index 0000000000..ca39edcb99 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollow.java @@ -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; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollowExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollowExample.java new file mode 100644 index 0000000000..9c6ce4f239 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionFollowExample.java @@ -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 oredCriteria; + + public ApiDefinitionFollowExample() { + oredCriteria = new ArrayList(); + } + + 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("definition_id in", values, "definitionId"); + return (Criteria) this; + } + + public Criteria andDefinitionIdNotIn(List 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 values) { + addCriterion("follow_id in", values, "followId"); + return (Criteria) this; + } + + public Criteria andFollowIdNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollow.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollow.java new file mode 100644 index 0000000000..b11e2b6254 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollow.java @@ -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; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollowExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollowExample.java new file mode 100644 index 0000000000..8e3ddf2ce7 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioFollowExample.java @@ -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 oredCriteria; + + public ApiScenarioFollowExample() { + oredCriteria = new ArrayList(); + } + + 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("scenario_id in", values, "scenarioId"); + return (Criteria) this; + } + + public Criteria andScenarioIdNotIn(List 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 values) { + addCriterion("follow_id in", values, "followId"); + return (Criteria) this; + } + + public Criteria andFollowIdNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollow.java b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollow.java new file mode 100644 index 0000000000..ee6cd91fa4 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollow.java @@ -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; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollowExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollowExample.java new file mode 100644 index 0000000000..c244d49cdc --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseFollowExample.java @@ -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 oredCriteria; + + public ApiTestCaseFollowExample() { + oredCriteria = new ArrayList(); + } + + 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("case_id in", values, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotIn(List 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 values) { + addCriterion("follow_id in", values, "followId"); + return (Criteria) this; + } + + public Criteria andFollowIdNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseFollow.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseFollow.java new file mode 100644 index 0000000000..723dcccb95 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseFollow.java @@ -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; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseFollowExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseFollowExample.java new file mode 100644 index 0000000000..07afb6ce12 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseFollowExample.java @@ -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 oredCriteria; + + public TestCaseFollowExample() { + oredCriteria = new ArrayList(); + } + + 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("case_id in", values, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotIn(List 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 values) { + addCriterion("follow_id in", values, "followId"); + return (Criteria) this; + } + + public Criteria andFollowIdNotIn(List 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); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.java new file mode 100644 index 0000000000..38fe391f8f --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.java @@ -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 selectByExample(ApiDefinitionFollowExample example); + + int updateByExampleSelective(@Param("record") ApiDefinitionFollow record, @Param("example") ApiDefinitionFollowExample example); + + int updateByExample(@Param("record") ApiDefinitionFollow record, @Param("example") ApiDefinitionFollowExample example); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.xml new file mode 100644 index 0000000000..2ae640c5b0 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionFollowMapper.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + definition_id, follow_id + + + + delete from api_definition_follow + + + + + + insert into api_definition_follow (definition_id, follow_id) + values (#{definitionId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR}) + + + insert into api_definition_follow + + + definition_id, + + + follow_id, + + + + + #{definitionId,jdbcType=VARCHAR}, + + + #{followId,jdbcType=VARCHAR}, + + + + + + update api_definition_follow + + + definition_id = #{record.definitionId,jdbcType=VARCHAR}, + + + follow_id = #{record.followId,jdbcType=VARCHAR}, + + + + + + + + update api_definition_follow + set definition_id = #{record.definitionId,jdbcType=VARCHAR}, + follow_id = #{record.followId,jdbcType=VARCHAR} + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.java new file mode 100644 index 0000000000..f132360bb8 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.java @@ -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 selectByExample(ApiScenarioFollowExample example); + + int updateByExampleSelective(@Param("record") ApiScenarioFollow record, @Param("example") ApiScenarioFollowExample example); + + int updateByExample(@Param("record") ApiScenarioFollow record, @Param("example") ApiScenarioFollowExample example); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.xml new file mode 100644 index 0000000000..2e4fb17a9b --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioFollowMapper.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + scenario_id, follow_id + + + + delete from api_scenario_follow + + + + + + insert into api_scenario_follow (scenario_id, follow_id) + values (#{scenarioId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR}) + + + insert into api_scenario_follow + + + scenario_id, + + + follow_id, + + + + + #{scenarioId,jdbcType=VARCHAR}, + + + #{followId,jdbcType=VARCHAR}, + + + + + + update api_scenario_follow + + + scenario_id = #{record.scenarioId,jdbcType=VARCHAR}, + + + follow_id = #{record.followId,jdbcType=VARCHAR}, + + + + + + + + update api_scenario_follow + set scenario_id = #{record.scenarioId,jdbcType=VARCHAR}, + follow_id = #{record.followId,jdbcType=VARCHAR} + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.java new file mode 100644 index 0000000000..15a455aed1 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.java @@ -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 selectByExample(ApiTestCaseFollowExample example); + + int updateByExampleSelective(@Param("record") ApiTestCaseFollow record, @Param("example") ApiTestCaseFollowExample example); + + int updateByExample(@Param("record") ApiTestCaseFollow record, @Param("example") ApiTestCaseFollowExample example); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.xml new file mode 100644 index 0000000000..562c138dc3 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiTestCaseFollowMapper.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + case_id, follow_id + + + + delete from api_test_case_follow + + + + + + insert into api_test_case_follow (case_id, follow_id) + values (#{caseId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR}) + + + insert into api_test_case_follow + + + case_id, + + + follow_id, + + + + + #{caseId,jdbcType=VARCHAR}, + + + #{followId,jdbcType=VARCHAR}, + + + + + + update api_test_case_follow + + + case_id = #{record.caseId,jdbcType=VARCHAR}, + + + follow_id = #{record.followId,jdbcType=VARCHAR}, + + + + + + + + update api_test_case_follow + set case_id = #{record.caseId,jdbcType=VARCHAR}, + follow_id = #{record.followId,jdbcType=VARCHAR} + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.java b/backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.java new file mode 100644 index 0000000000..6a732ebbad --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.java @@ -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 selectByExample(TestCaseFollowExample example); + + int updateByExampleSelective(@Param("record") TestCaseFollow record, @Param("example") TestCaseFollowExample example); + + int updateByExample(@Param("record") TestCaseFollow record, @Param("example") TestCaseFollowExample example); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.xml new file mode 100644 index 0000000000..97a8f97ec1 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseFollowMapper.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + case_id, follow_id + + + + delete from test_case_follow + + + + + + insert into test_case_follow (case_id, follow_id) + values (#{caseId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR}) + + + insert into test_case_follow + + + case_id, + + + follow_id, + + + + + #{caseId,jdbcType=VARCHAR}, + + + #{followId,jdbcType=VARCHAR}, + + + + + + update test_case_follow + + + case_id = #{record.caseId,jdbcType=VARCHAR}, + + + follow_id = #{record.followId,jdbcType=VARCHAR}, + + + + + + + + update test_case_follow + set case_id = #{record.caseId,jdbcType=VARCHAR}, + follow_id = #{record.followId,jdbcType=VARCHAR} + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index c60ec2a1b7..9611078a95 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -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) { diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 04bc4694ca..35e3a0649d 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -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);