mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
feat(测试计划): 编写测试计划接口用例场景用例的关联和排序功能
This commit is contained in:
parent
d24ed20bb5
commit
4e2ecfdb6f
@ -15,6 +15,9 @@ public class TestPlanApiCase implements Serializable {
|
||||
@Size(min = 1, max = 50, message = "{test_plan_api_case.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(description = "num")
|
||||
private Long num;
|
||||
|
||||
@Schema(description = "测试计划ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_api_case.test_plan_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_api_case.test_plan_id.length_range}", groups = {Created.class, Updated.class})
|
||||
@ -51,6 +54,7 @@ public class TestPlanApiCase implements Serializable {
|
||||
|
||||
public enum Column {
|
||||
id("id", "id", "VARCHAR", false),
|
||||
num("num", "num", "BIGINT", false),
|
||||
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
|
||||
apiCaseId("api_case_id", "apiCaseId", "VARCHAR", false),
|
||||
lastExecResult("last_exec_result", "lastExecResult", "VARCHAR", false),
|
||||
|
@ -174,6 +174,66 @@ public class TestPlanApiCaseExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNull() {
|
||||
addCriterion("num is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNotNull() {
|
||||
addCriterion("num is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumEqualTo(Long value) {
|
||||
addCriterion("num =", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotEqualTo(Long value) {
|
||||
addCriterion("num <>", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThan(Long value) {
|
||||
addCriterion("num >", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("num >=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThan(Long value) {
|
||||
addCriterion("num <", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThanOrEqualTo(Long value) {
|
||||
addCriterion("num <=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIn(List<Long> values) {
|
||||
addCriterion("num in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotIn(List<Long> values) {
|
||||
addCriterion("num not in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumBetween(Long value1, Long value2) {
|
||||
addCriterion("num between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotBetween(Long value1, Long value2) {
|
||||
addCriterion("num not between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdIsNull() {
|
||||
addCriterion("test_plan_id is null");
|
||||
return (Criteria) this;
|
||||
|
@ -15,6 +15,9 @@ public class TestPlanApiScenario implements Serializable {
|
||||
@Size(min = 1, max = 50, message = "{test_plan_api_scenario.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(description = "num")
|
||||
private Long num;
|
||||
|
||||
@Schema(description = "测试计划ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_api_scenario.test_plan_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_api_scenario.test_plan_id.length_range}", groups = {Created.class, Updated.class})
|
||||
@ -49,6 +52,7 @@ public class TestPlanApiScenario implements Serializable {
|
||||
|
||||
public enum Column {
|
||||
id("id", "id", "VARCHAR", false),
|
||||
num("num", "num", "BIGINT", false),
|
||||
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
|
||||
apiScenarioId("api_scenario_id", "apiScenarioId", "VARCHAR", false),
|
||||
lastExecResult("last_exec_result", "lastExecResult", "VARCHAR", false),
|
||||
|
@ -174,6 +174,66 @@ public class TestPlanApiScenarioExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNull() {
|
||||
addCriterion("num is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNotNull() {
|
||||
addCriterion("num is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumEqualTo(Long value) {
|
||||
addCriterion("num =", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotEqualTo(Long value) {
|
||||
addCriterion("num <>", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThan(Long value) {
|
||||
addCriterion("num >", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("num >=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThan(Long value) {
|
||||
addCriterion("num <", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThanOrEqualTo(Long value) {
|
||||
addCriterion("num <=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIn(List<Long> values) {
|
||||
addCriterion("num in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotIn(List<Long> values) {
|
||||
addCriterion("num not in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumBetween(Long value1, Long value2) {
|
||||
addCriterion("num between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotBetween(Long value1, Long value2) {
|
||||
addCriterion("num not between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdIsNull() {
|
||||
addCriterion("test_plan_id is null");
|
||||
return (Criteria) this;
|
||||
|
@ -0,0 +1,126 @@
|
||||
package io.metersphere.plan.domain;
|
||||
|
||||
import io.metersphere.validation.groups.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TestPlanBug implements Serializable {
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_bug.id.not_blank}", groups = {Updated.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_bug.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(description = "num")
|
||||
private Long num;
|
||||
|
||||
@Schema(description = "测试计划ID;测试计划ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_bug.test_plan_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_bug.test_plan_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String testPlanId;
|
||||
|
||||
@Schema(description = "接口用例ID;测试用例ID(包含功能、接口、场景等)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_bug.case_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_bug.case_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String caseId;
|
||||
|
||||
@Schema(description = "用例类型;用例类型(FUNCTIONAL_CASE/API_TEST_CASE/API_SCENARIO)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_bug.case_type.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_bug.case_type.length_range}", groups = {Created.class, Updated.class})
|
||||
private String caseType;
|
||||
|
||||
@Schema(description = "缺陷id;缺陷ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_bug.bug_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_bug.bug_id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String bugId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createUser;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum Column {
|
||||
id("id", "id", "VARCHAR", false),
|
||||
num("num", "num", "BIGINT", false),
|
||||
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
|
||||
caseId("case_id", "caseId", "VARCHAR", false),
|
||||
caseType("case_type", "caseType", "VARCHAR", false),
|
||||
bugId("bug_id", "bugId", "VARCHAR", false),
|
||||
createTime("create_time", "createTime", "BIGINT", false),
|
||||
createUser("create_user", "createUser", "VARCHAR", false);
|
||||
|
||||
private static final String BEGINNING_DELIMITER = "`";
|
||||
|
||||
private static final String ENDING_DELIMITER = "`";
|
||||
|
||||
private final String column;
|
||||
|
||||
private final boolean isColumnNameDelimited;
|
||||
|
||||
private final String javaProperty;
|
||||
|
||||
private final String jdbcType;
|
||||
|
||||
public String value() {
|
||||
return this.column;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.column;
|
||||
}
|
||||
|
||||
public String getJavaProperty() {
|
||||
return this.javaProperty;
|
||||
}
|
||||
|
||||
public String getJdbcType() {
|
||||
return this.jdbcType;
|
||||
}
|
||||
|
||||
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
|
||||
this.column = column;
|
||||
this.javaProperty = javaProperty;
|
||||
this.jdbcType = jdbcType;
|
||||
this.isColumnNameDelimited = isColumnNameDelimited;
|
||||
}
|
||||
|
||||
public String desc() {
|
||||
return this.getEscapedColumnName() + " DESC";
|
||||
}
|
||||
|
||||
public String asc() {
|
||||
return this.getEscapedColumnName() + " ASC";
|
||||
}
|
||||
|
||||
public static Column[] excludes(Column ... excludes) {
|
||||
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
|
||||
if (excludes != null && excludes.length > 0) {
|
||||
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
|
||||
}
|
||||
return columns.toArray(new Column[]{});
|
||||
}
|
||||
|
||||
public static Column[] all() {
|
||||
return Column.values();
|
||||
}
|
||||
|
||||
public String getEscapedColumnName() {
|
||||
if (this.isColumnNameDelimited) {
|
||||
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
|
||||
} else {
|
||||
return this.column;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAliasedEscapedColumnName() {
|
||||
return this.getEscapedColumnName();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,740 @@
|
||||
package io.metersphere.plan.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestPlanBugExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public TestPlanBugExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(String value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(String value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(String value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(String value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLike(String value) {
|
||||
addCriterion("id like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotLike(String value) {
|
||||
addCriterion("id not like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(String value1, String value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(String value1, String value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNull() {
|
||||
addCriterion("num is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNotNull() {
|
||||
addCriterion("num is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumEqualTo(Long value) {
|
||||
addCriterion("num =", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotEqualTo(Long value) {
|
||||
addCriterion("num <>", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThan(Long value) {
|
||||
addCriterion("num >", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("num >=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThan(Long value) {
|
||||
addCriterion("num <", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThanOrEqualTo(Long value) {
|
||||
addCriterion("num <=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIn(List<Long> values) {
|
||||
addCriterion("num in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotIn(List<Long> values) {
|
||||
addCriterion("num not in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumBetween(Long value1, Long value2) {
|
||||
addCriterion("num between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotBetween(Long value1, Long value2) {
|
||||
addCriterion("num not between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdIsNull() {
|
||||
addCriterion("test_plan_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdIsNotNull() {
|
||||
addCriterion("test_plan_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdEqualTo(String value) {
|
||||
addCriterion("test_plan_id =", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdNotEqualTo(String value) {
|
||||
addCriterion("test_plan_id <>", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdGreaterThan(String value) {
|
||||
addCriterion("test_plan_id >", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("test_plan_id >=", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdLessThan(String value) {
|
||||
addCriterion("test_plan_id <", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("test_plan_id <=", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdLike(String value) {
|
||||
addCriterion("test_plan_id like", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdNotLike(String value) {
|
||||
addCriterion("test_plan_id not like", value, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdIn(List<String> values) {
|
||||
addCriterion("test_plan_id in", values, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdNotIn(List<String> values) {
|
||||
addCriterion("test_plan_id not in", values, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdBetween(String value1, String value2) {
|
||||
addCriterion("test_plan_id between", value1, value2, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdNotBetween(String value1, String value2) {
|
||||
addCriterion("test_plan_id not between", value1, value2, "testPlanId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
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 andCaseTypeIsNull() {
|
||||
addCriterion("case_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeIsNotNull() {
|
||||
addCriterion("case_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeEqualTo(String value) {
|
||||
addCriterion("case_type =", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeNotEqualTo(String value) {
|
||||
addCriterion("case_type <>", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeGreaterThan(String value) {
|
||||
addCriterion("case_type >", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("case_type >=", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeLessThan(String value) {
|
||||
addCriterion("case_type <", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("case_type <=", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeLike(String value) {
|
||||
addCriterion("case_type like", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeNotLike(String value) {
|
||||
addCriterion("case_type not like", value, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeIn(List<String> values) {
|
||||
addCriterion("case_type in", values, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeNotIn(List<String> values) {
|
||||
addCriterion("case_type not in", values, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeBetween(String value1, String value2) {
|
||||
addCriterion("case_type between", value1, value2, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("case_type not between", value1, value2, "caseType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdIsNull() {
|
||||
addCriterion("bug_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdIsNotNull() {
|
||||
addCriterion("bug_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdEqualTo(String value) {
|
||||
addCriterion("bug_id =", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdNotEqualTo(String value) {
|
||||
addCriterion("bug_id <>", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdGreaterThan(String value) {
|
||||
addCriterion("bug_id >", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("bug_id >=", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdLessThan(String value) {
|
||||
addCriterion("bug_id <", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("bug_id <=", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdLike(String value) {
|
||||
addCriterion("bug_id like", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdNotLike(String value) {
|
||||
addCriterion("bug_id not like", value, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdIn(List<String> values) {
|
||||
addCriterion("bug_id in", values, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdNotIn(List<String> values) {
|
||||
addCriterion("bug_id not in", values, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdBetween(String value1, String value2) {
|
||||
addCriterion("bug_id between", value1, value2, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBugIdNotBetween(String value1, String value2) {
|
||||
addCriterion("bug_id not between", value1, value2, "bugId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNotNull() {
|
||||
addCriterion("create_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeEqualTo(Long value) {
|
||||
addCriterion("create_time =", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotEqualTo(Long value) {
|
||||
addCriterion("create_time <>", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThan(Long value) {
|
||||
addCriterion("create_time >", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("create_time >=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThan(Long value) {
|
||||
addCriterion("create_time <", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("create_time <=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIn(List<Long> values) {
|
||||
addCriterion("create_time in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotIn(List<Long> values) {
|
||||
addCriterion("create_time not in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("create_time between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("create_time not between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserIsNull() {
|
||||
addCriterion("create_user is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserIsNotNull() {
|
||||
addCriterion("create_user is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserEqualTo(String value) {
|
||||
addCriterion("create_user =", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserNotEqualTo(String value) {
|
||||
addCriterion("create_user <>", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserGreaterThan(String value) {
|
||||
addCriterion("create_user >", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("create_user >=", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserLessThan(String value) {
|
||||
addCriterion("create_user <", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserLessThanOrEqualTo(String value) {
|
||||
addCriterion("create_user <=", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserLike(String value) {
|
||||
addCriterion("create_user like", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserNotLike(String value) {
|
||||
addCriterion("create_user not like", value, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserIn(List<String> values) {
|
||||
addCriterion("create_user in", values, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserNotIn(List<String> values) {
|
||||
addCriterion("create_user not in", values, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserBetween(String value1, String value2) {
|
||||
addCriterion("create_user between", value1, value2, "createUser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserNotBetween(String value1, String value2) {
|
||||
addCriterion("create_user not between", value1, value2, "createUser");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,9 @@ public class TestPlanFunctionalCase implements Serializable {
|
||||
@Size(min = 1, max = 50, message = "{test_plan_functional_case.id.length_range}", groups = {Created.class, Updated.class})
|
||||
private String id;
|
||||
|
||||
@Schema(description = "num")
|
||||
private Long num;
|
||||
|
||||
@Schema(description = "测试计划ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{test_plan_functional_case.test_plan_id.not_blank}", groups = {Created.class})
|
||||
@Size(min = 1, max = 50, message = "{test_plan_functional_case.test_plan_id.length_range}", groups = {Created.class, Updated.class})
|
||||
@ -48,6 +51,7 @@ public class TestPlanFunctionalCase implements Serializable {
|
||||
|
||||
public enum Column {
|
||||
id("id", "id", "VARCHAR", false),
|
||||
num("num", "num", "BIGINT", false),
|
||||
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
|
||||
functionalCaseId("functional_case_id", "functionalCaseId", "VARCHAR", false),
|
||||
createTime("create_time", "createTime", "BIGINT", false),
|
||||
|
@ -174,6 +174,66 @@ public class TestPlanFunctionalCaseExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNull() {
|
||||
addCriterion("num is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIsNotNull() {
|
||||
addCriterion("num is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumEqualTo(Long value) {
|
||||
addCriterion("num =", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotEqualTo(Long value) {
|
||||
addCriterion("num <>", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThan(Long value) {
|
||||
addCriterion("num >", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("num >=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThan(Long value) {
|
||||
addCriterion("num <", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumLessThanOrEqualTo(Long value) {
|
||||
addCriterion("num <=", value, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumIn(List<Long> values) {
|
||||
addCriterion("num in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotIn(List<Long> values) {
|
||||
addCriterion("num not in", values, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumBetween(Long value1, Long value2) {
|
||||
addCriterion("num between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNumNotBetween(Long value1, Long value2) {
|
||||
addCriterion("num not between", value1, value2, "num");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestPlanIdIsNull() {
|
||||
addCriterion("test_plan_id is null");
|
||||
return (Criteria) this;
|
||||
|
@ -3,6 +3,7 @@
|
||||
<mapper namespace="io.metersphere.plan.mapper.TestPlanApiCaseMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="num" jdbcType="BIGINT" property="num" />
|
||||
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
||||
<result column="api_case_id" jdbcType="VARCHAR" property="apiCaseId" />
|
||||
<result column="last_exec_result" jdbcType="VARCHAR" property="lastExecResult" />
|
||||
@ -74,7 +75,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, test_plan_id, api_case_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
id, num, test_plan_id, api_case_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
create_time, create_user, pos
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
@ -129,14 +130,14 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
insert into test_plan_api_case (id, test_plan_id, api_case_id,
|
||||
last_exec_result, last_exec_report_id, execute_user,
|
||||
create_time, create_user, pos,
|
||||
environment_id)
|
||||
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{apiCaseId,jdbcType=VARCHAR},
|
||||
#{lastExecResult,jdbcType=VARCHAR}, #{lastExecReportId,jdbcType=VARCHAR}, #{executeUser,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT},
|
||||
#{environmentId,jdbcType=LONGVARCHAR})
|
||||
insert into test_plan_api_case (id, num, test_plan_id,
|
||||
api_case_id, last_exec_result, last_exec_report_id,
|
||||
execute_user, create_time, create_user,
|
||||
pos, environment_id)
|
||||
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{testPlanId,jdbcType=VARCHAR},
|
||||
#{apiCaseId,jdbcType=VARCHAR}, #{lastExecResult,jdbcType=VARCHAR}, #{lastExecReportId,jdbcType=VARCHAR},
|
||||
#{executeUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
|
||||
#{pos,jdbcType=BIGINT}, #{environmentId,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
insert into test_plan_api_case
|
||||
@ -144,6 +145,9 @@
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num,
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id,
|
||||
</if>
|
||||
@ -176,6 +180,9 @@
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
#{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
#{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -217,6 +224,9 @@
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.num != null">
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.testPlanId != null">
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -252,6 +262,7 @@
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update test_plan_api_case
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
api_case_id = #{record.apiCaseId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{record.lastExecResult,jdbcType=VARCHAR},
|
||||
@ -268,6 +279,7 @@
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update test_plan_api_case
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
api_case_id = #{record.apiCaseId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{record.lastExecResult,jdbcType=VARCHAR},
|
||||
@ -283,6 +295,9 @@
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
update test_plan_api_case
|
||||
<set>
|
||||
<if test="num != null">
|
||||
num = #{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -315,7 +330,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
update test_plan_api_case
|
||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
set num = #{num,jdbcType=BIGINT},
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
api_case_id = #{apiCaseId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{lastExecResult,jdbcType=VARCHAR},
|
||||
last_exec_report_id = #{lastExecReportId,jdbcType=VARCHAR},
|
||||
@ -328,7 +344,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanApiCase">
|
||||
update test_plan_api_case
|
||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
set num = #{num,jdbcType=BIGINT},
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
api_case_id = #{apiCaseId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{lastExecResult,jdbcType=VARCHAR},
|
||||
last_exec_report_id = #{lastExecReportId,jdbcType=VARCHAR},
|
||||
@ -340,12 +357,12 @@
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into test_plan_api_case
|
||||
(id, test_plan_id, api_case_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
(id, num, test_plan_id, api_case_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
create_time, create_user, pos, environment_id)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR}, #{item.apiCaseId,jdbcType=VARCHAR},
|
||||
#{item.lastExecResult,jdbcType=VARCHAR}, #{item.lastExecReportId,jdbcType=VARCHAR},
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.testPlanId,jdbcType=VARCHAR},
|
||||
#{item.apiCaseId,jdbcType=VARCHAR}, #{item.lastExecResult,jdbcType=VARCHAR}, #{item.lastExecReportId,jdbcType=VARCHAR},
|
||||
#{item.executeUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
|
||||
#{item.pos,jdbcType=BIGINT}, #{item.environmentId,jdbcType=LONGVARCHAR})
|
||||
</foreach>
|
||||
@ -363,6 +380,9 @@
|
||||
<if test="'id'.toString() == column.value">
|
||||
#{item.id,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'num'.toString() == column.value">
|
||||
#{item.num,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="'test_plan_id'.toString() == column.value">
|
||||
#{item.testPlanId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<mapper namespace="io.metersphere.plan.mapper.TestPlanApiScenarioMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="num" jdbcType="BIGINT" property="num" />
|
||||
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
||||
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId" />
|
||||
<result column="last_exec_result" jdbcType="VARCHAR" property="lastExecResult" />
|
||||
@ -74,7 +75,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, test_plan_id, api_scenario_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
id, num, test_plan_id, api_scenario_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
create_time, create_user, pos
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
@ -129,14 +130,14 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
insert into test_plan_api_scenario (id, test_plan_id, api_scenario_id,
|
||||
last_exec_result, last_exec_report_id, execute_user,
|
||||
create_time, create_user, pos,
|
||||
environment_id)
|
||||
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
|
||||
#{lastExecResult,jdbcType=VARCHAR}, #{lastExecReportId,jdbcType=VARCHAR}, #{executeUser,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT},
|
||||
#{environmentId,jdbcType=LONGVARCHAR})
|
||||
insert into test_plan_api_scenario (id, num, test_plan_id,
|
||||
api_scenario_id, last_exec_result, last_exec_report_id,
|
||||
execute_user, create_time, create_user,
|
||||
pos, environment_id)
|
||||
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{testPlanId,jdbcType=VARCHAR},
|
||||
#{apiScenarioId,jdbcType=VARCHAR}, #{lastExecResult,jdbcType=VARCHAR}, #{lastExecReportId,jdbcType=VARCHAR},
|
||||
#{executeUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
|
||||
#{pos,jdbcType=BIGINT}, #{environmentId,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
insert into test_plan_api_scenario
|
||||
@ -144,6 +145,9 @@
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num,
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id,
|
||||
</if>
|
||||
@ -176,6 +180,9 @@
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
#{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
#{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -217,6 +224,9 @@
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.num != null">
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.testPlanId != null">
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -252,6 +262,7 @@
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update test_plan_api_scenario
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{record.lastExecResult,jdbcType=VARCHAR},
|
||||
@ -268,6 +279,7 @@
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update test_plan_api_scenario
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{record.lastExecResult,jdbcType=VARCHAR},
|
||||
@ -283,6 +295,9 @@
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
update test_plan_api_scenario
|
||||
<set>
|
||||
<if test="num != null">
|
||||
num = #{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -315,7 +330,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
update test_plan_api_scenario
|
||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
set num = #{num,jdbcType=BIGINT},
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{lastExecResult,jdbcType=VARCHAR},
|
||||
last_exec_report_id = #{lastExecReportId,jdbcType=VARCHAR},
|
||||
@ -328,7 +344,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanApiScenario">
|
||||
update test_plan_api_scenario
|
||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
set num = #{num,jdbcType=BIGINT},
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
||||
last_exec_result = #{lastExecResult,jdbcType=VARCHAR},
|
||||
last_exec_report_id = #{lastExecReportId,jdbcType=VARCHAR},
|
||||
@ -340,14 +357,15 @@
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into test_plan_api_scenario
|
||||
(id, test_plan_id, api_scenario_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
(id, num, test_plan_id, api_scenario_id, last_exec_result, last_exec_report_id, execute_user,
|
||||
create_time, create_user, pos, environment_id)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR}, #{item.apiScenarioId,jdbcType=VARCHAR},
|
||||
#{item.lastExecResult,jdbcType=VARCHAR}, #{item.lastExecReportId,jdbcType=VARCHAR},
|
||||
#{item.executeUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
|
||||
#{item.pos,jdbcType=BIGINT}, #{item.environmentId,jdbcType=LONGVARCHAR})
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.testPlanId,jdbcType=VARCHAR},
|
||||
#{item.apiScenarioId,jdbcType=VARCHAR}, #{item.lastExecResult,jdbcType=VARCHAR},
|
||||
#{item.lastExecReportId,jdbcType=VARCHAR}, #{item.executeUser,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT},
|
||||
#{item.environmentId,jdbcType=LONGVARCHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
@ -363,6 +381,9 @@
|
||||
<if test="'id'.toString() == column.value">
|
||||
#{item.id,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'num'.toString() == column.value">
|
||||
#{item.num,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="'test_plan_id'.toString() == column.value">
|
||||
#{item.testPlanId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
@ -0,0 +1,34 @@
|
||||
package io.metersphere.plan.mapper;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlanBug;
|
||||
import io.metersphere.plan.domain.TestPlanBugExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface TestPlanBugMapper {
|
||||
long countByExample(TestPlanBugExample example);
|
||||
|
||||
int deleteByExample(TestPlanBugExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(TestPlanBug record);
|
||||
|
||||
int insertSelective(TestPlanBug record);
|
||||
|
||||
List<TestPlanBug> selectByExample(TestPlanBugExample example);
|
||||
|
||||
TestPlanBug selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") TestPlanBug record, @Param("example") TestPlanBugExample example);
|
||||
|
||||
int updateByExample(@Param("record") TestPlanBug record, @Param("example") TestPlanBugExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(TestPlanBug record);
|
||||
|
||||
int updateByPrimaryKey(TestPlanBug record);
|
||||
|
||||
int batchInsert(@Param("list") List<TestPlanBug> list);
|
||||
|
||||
int batchInsertSelective(@Param("list") List<TestPlanBug> list, @Param("selective") TestPlanBug.Column ... selective);
|
||||
}
|
@ -0,0 +1,306 @@
|
||||
<?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.plan.mapper.TestPlanBugMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanBug">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="num" jdbcType="BIGINT" property="num" />
|
||||
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
||||
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
|
||||
<result column="case_type" jdbcType="VARCHAR" property="caseType" />
|
||||
<result column="bug_id" jdbcType="VARCHAR" property="bugId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, num, test_plan_id, case_id, case_type, bug_id, create_time, create_user
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanBugExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from test_plan_bug
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from test_plan_bug
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from test_plan_bug
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.plan.domain.TestPlanBugExample">
|
||||
delete from test_plan_bug
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanBug">
|
||||
insert into test_plan_bug (id, num, test_plan_id,
|
||||
case_id, case_type, bug_id,
|
||||
create_time, create_user)
|
||||
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{testPlanId,jdbcType=VARCHAR},
|
||||
#{caseId,jdbcType=VARCHAR}, #{caseType,jdbcType=VARCHAR}, #{bugId,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanBug">
|
||||
insert into test_plan_bug
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num,
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id,
|
||||
</if>
|
||||
<if test="caseId != null">
|
||||
case_id,
|
||||
</if>
|
||||
<if test="caseType != null">
|
||||
case_type,
|
||||
</if>
|
||||
<if test="bugId != null">
|
||||
bug_id,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="createUser != null">
|
||||
create_user,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
#{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
#{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="caseId != null">
|
||||
#{caseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="caseType != null">
|
||||
#{caseType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="bugId != null">
|
||||
#{bugId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createUser != null">
|
||||
#{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanBugExample" resultType="java.lang.Long">
|
||||
select count(*) from test_plan_bug
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update test_plan_bug
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.num != null">
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.testPlanId != null">
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.caseId != null">
|
||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.caseType != null">
|
||||
case_type = #{record.caseType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.bugId != null">
|
||||
bug_id = #{record.bugId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.createUser != null">
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update test_plan_bug
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||
case_type = #{record.caseType,jdbcType=VARCHAR},
|
||||
bug_id = #{record.bugId,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.plan.domain.TestPlanBug">
|
||||
update test_plan_bug
|
||||
<set>
|
||||
<if test="num != null">
|
||||
num = #{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="caseId != null">
|
||||
case_id = #{caseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="caseType != null">
|
||||
case_type = #{caseType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="bugId != null">
|
||||
bug_id = #{bugId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="createUser != null">
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanBug">
|
||||
update test_plan_bug
|
||||
set num = #{num,jdbcType=BIGINT},
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
case_id = #{caseId,jdbcType=VARCHAR},
|
||||
case_type = #{caseType,jdbcType=VARCHAR},
|
||||
bug_id = #{bugId,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
create_user = #{createUser,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into test_plan_bug
|
||||
(id, num, test_plan_id, case_id, case_type, bug_id, create_time, create_user)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.testPlanId,jdbcType=VARCHAR},
|
||||
#{item.caseId,jdbcType=VARCHAR}, #{item.caseType,jdbcType=VARCHAR}, #{item.bugId,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
insert into test_plan_bug (
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
<if test="'id'.toString() == column.value">
|
||||
#{item.id,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'num'.toString() == column.value">
|
||||
#{item.num,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="'test_plan_id'.toString() == column.value">
|
||||
#{item.testPlanId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'case_id'.toString() == column.value">
|
||||
#{item.caseId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'case_type'.toString() == column.value">
|
||||
#{item.caseType,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'bug_id'.toString() == column.value">
|
||||
#{item.bugId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'create_time'.toString() == column.value">
|
||||
#{item.createTime,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="'create_user'.toString() == column.value">
|
||||
#{item.createUser,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
@ -3,6 +3,7 @@
|
||||
<mapper namespace="io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanFunctionalCase">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="num" jdbcType="BIGINT" property="num" />
|
||||
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
||||
<result column="functional_case_id" jdbcType="VARCHAR" property="functionalCaseId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
@ -71,8 +72,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, test_plan_id, functional_case_id, create_time, create_user, execute_user, last_exec_time,
|
||||
last_exec_result, pos
|
||||
id, num, test_plan_id, functional_case_id, create_time, create_user, execute_user,
|
||||
last_exec_time, last_exec_result, pos
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanFunctionalCaseExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -105,14 +106,14 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanFunctionalCase">
|
||||
insert into test_plan_functional_case (id, test_plan_id, functional_case_id,
|
||||
create_time, create_user, execute_user,
|
||||
last_exec_time, last_exec_result, pos
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{functionalCaseId,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{executeUser,jdbcType=VARCHAR},
|
||||
#{lastExecTime,jdbcType=BIGINT}, #{lastExecResult,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}
|
||||
)
|
||||
insert into test_plan_functional_case (id, num, test_plan_id,
|
||||
functional_case_id, create_time, create_user,
|
||||
execute_user, last_exec_time, last_exec_result,
|
||||
pos)
|
||||
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{testPlanId,jdbcType=VARCHAR},
|
||||
#{functionalCaseId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
|
||||
#{executeUser,jdbcType=VARCHAR}, #{lastExecTime,jdbcType=BIGINT}, #{lastExecResult,jdbcType=VARCHAR},
|
||||
#{pos,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanFunctionalCase">
|
||||
insert into test_plan_functional_case
|
||||
@ -120,6 +121,9 @@
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="num != null">
|
||||
num,
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id,
|
||||
</if>
|
||||
@ -149,6 +153,9 @@
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="num != null">
|
||||
#{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
#{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -187,6 +194,9 @@
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.num != null">
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.testPlanId != null">
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -219,6 +229,7 @@
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update test_plan_functional_case
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
num = #{record.num,jdbcType=BIGINT},
|
||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||
functional_case_id = #{record.functionalCaseId,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
@ -234,6 +245,9 @@
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.plan.domain.TestPlanFunctionalCase">
|
||||
update test_plan_functional_case
|
||||
<set>
|
||||
<if test="num != null">
|
||||
num = #{num,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testPlanId != null">
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -263,7 +277,8 @@
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanFunctionalCase">
|
||||
update test_plan_functional_case
|
||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
set num = #{num,jdbcType=BIGINT},
|
||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||
functional_case_id = #{functionalCaseId,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
@ -275,14 +290,14 @@
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into test_plan_functional_case
|
||||
(id, test_plan_id, functional_case_id, create_time, create_user, execute_user, last_exec_time,
|
||||
last_exec_result, pos)
|
||||
(id, num, test_plan_id, functional_case_id, create_time, create_user, execute_user,
|
||||
last_exec_time, last_exec_result, pos)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR}, #{item.functionalCaseId,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}, #{item.executeUser,jdbcType=VARCHAR},
|
||||
#{item.lastExecTime,jdbcType=BIGINT}, #{item.lastExecResult,jdbcType=VARCHAR},
|
||||
#{item.pos,jdbcType=BIGINT})
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.testPlanId,jdbcType=VARCHAR},
|
||||
#{item.functionalCaseId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
|
||||
#{item.createUser,jdbcType=VARCHAR}, #{item.executeUser,jdbcType=VARCHAR}, #{item.lastExecTime,jdbcType=BIGINT},
|
||||
#{item.lastExecResult,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
@ -298,6 +313,9 @@
|
||||
<if test="'id'.toString() == column.value">
|
||||
#{item.id,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'num'.toString() == column.value">
|
||||
#{item.num,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="'test_plan_id'.toString() == column.value">
|
||||
#{item.testPlanId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
@ -68,18 +68,10 @@ CREATE TABLE IF NOT EXISTS test_plan_config
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '测试计划配置';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS test_plan_follower
|
||||
(
|
||||
`test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划ID;联合主键',
|
||||
`user_id` VARCHAR(50) NOT NULL COMMENT '用户ID;联合主键',
|
||||
PRIMARY KEY (test_plan_id, user_id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '测试计划关注人';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS test_plan_functional_case
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
|
||||
`num` BIGINT NOT NULL COMMENT 'num' ,
|
||||
`test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划ID',
|
||||
`functional_case_id` VARCHAR(50) NOT NULL COMMENT '功能用例ID',
|
||||
`create_time` BIGINT NOT NULL COMMENT '创建时间',
|
||||
@ -100,6 +92,7 @@ CREATE INDEX idx_create_user ON test_plan_functional_case (create_user);
|
||||
CREATE TABLE IF NOT EXISTS test_plan_api_case
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
|
||||
`num` BIGINT NOT NULL COMMENT 'num',
|
||||
`test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划ID',
|
||||
`api_case_id` VARCHAR(50) NOT NULL COMMENT '接口用例ID',
|
||||
`environment_id` LONGTEXT COMMENT '所属环境',
|
||||
@ -122,6 +115,7 @@ CREATE INDEX idx_create_user ON test_plan_api_case (create_user);
|
||||
CREATE TABLE IF NOT EXISTS test_plan_api_scenario
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
|
||||
`num` BIGINT NOT NULL COMMENT 'num',
|
||||
`test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划ID',
|
||||
`api_scenario_id` VARCHAR(50) COMMENT '场景ID',
|
||||
`environment_id` LONGTEXT COMMENT '所属环境',
|
||||
@ -149,6 +143,26 @@ CREATE TABLE IF NOT EXISTS test_plan_follower
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '测试计划关注人';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS test_plan_bug
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
|
||||
`num` BIGINT NOT NULL COMMENT 'num',
|
||||
`test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划ID;测试计划ID',
|
||||
`case_id` VARCHAR(50) NOT NULL COMMENT '接口用例ID;测试用例ID(包含功能、接口、场景等)',
|
||||
`case_type` VARCHAR(50) NOT NULL COMMENT '用例类型;用例类型(FUNCTIONAL_CASE/API_TEST_CASE/API_SCENARIO)',
|
||||
`bug_id` VARCHAR(50) NOT NULL COMMENT '缺陷id;缺陷ID',
|
||||
`create_time` BIGINT NOT NULL COMMENT '创建时间',
|
||||
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '测试计划关联接口用例';
|
||||
|
||||
CREATE INDEX idx_case_id ON test_plan_bug (case_id);
|
||||
CREATE INDEX idx_test_plan_id ON test_plan_bug (test_plan_id);
|
||||
CREATE INDEX idx_create_user ON test_plan_bug (create_user);
|
||||
CREATE INDEX idx_bug_id ON test_plan_bug (bug_id);
|
||||
|
||||
|
||||
-- set innodb lock wait timeout to default
|
||||
SET SESSION innodb_lock_wait_timeout = DEFAULT;
|
@ -14,6 +14,9 @@ public enum ApplicationNumScope {
|
||||
LOAD_TEST,
|
||||
|
||||
TEST_PLAN,
|
||||
TEST_PLAN_FUNCTION_CASE,
|
||||
TEST_PLAN_API_CASE,
|
||||
TEST_PLAN_API_SCENARIO,
|
||||
|
||||
BUG_MANAGEMENT,
|
||||
|
||||
|
@ -8,7 +8,7 @@ import lombok.Data;
|
||||
public class FunctionalCaseTestPlanDTO extends TestPlanFunctionalCase {
|
||||
|
||||
@Schema(description = "测试计划ID")
|
||||
private String num;
|
||||
private String testPlanNum;
|
||||
|
||||
@Schema(description = "所属项目")
|
||||
private String projectName;
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
<select id="getPlanList" parameterType="io.metersphere.functional.request.AssociatePlanPageRequest" resultType="io.metersphere.functional.dto.FunctionalCaseTestPlanDTO">
|
||||
SELECT
|
||||
tpfc.*, tp.num as num, tp.status as planStatus, p.name as projectName
|
||||
tpfc.*, tp.num as testPlanNum, tp.status as planStatus, p.name as projectName
|
||||
FROM
|
||||
test_plan_functional_case tpfc
|
||||
LEFT JOIN test_plan tp ON tpfc.test_plan_id = tp.id
|
||||
|
@ -15,6 +15,6 @@ INSERT INTO project(id, num, organization_id, name, description, create_time, up
|
||||
UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, false, null, true, null);
|
||||
|
||||
|
||||
INSERT INTO test_plan_functional_case(id, test_plan_id, functional_case_id, create_time, create_user, last_exec_time, last_exec_result, pos)
|
||||
VALUES ('associate_case_plan_gyq_one', 'test_plan_associate_case_gyq_one', 'gyq_associate_function_case', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'SUCCESS', 200),
|
||||
INSERT INTO test_plan_functional_case(id,num, test_plan_id, functional_case_id, create_time, create_user, last_exec_time, last_exec_result, pos)
|
||||
VALUES ('associate_case_plan_gyq_one', '123456','test_plan_associate_case_gyq_one', 'gyq_associate_function_case', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'SUCCESS', 200),
|
||||
('associate_case_plan_gyq_two', 'test_plan_associate_case_gyq_two', 'gyq_associate_function_case', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'SUCCESS', 200);
|
@ -25,7 +25,7 @@ public class NumGenerator {
|
||||
private static StringRedisTemplate stringRedisTemplate;
|
||||
private static ProjectMapper projectMapper;
|
||||
|
||||
private static final List<ApplicationNumScope> SUB_NUM = List.of(ApplicationNumScope.API_TEST_CASE, ApplicationNumScope.API_MOCK);
|
||||
private static final List<ApplicationNumScope> SUB_NUM = List.of(ApplicationNumScope.API_TEST_CASE, ApplicationNumScope.API_MOCK, ApplicationNumScope.TEST_PLAN_FUNCTION_CASE, ApplicationNumScope.TEST_PLAN_API_CASE, ApplicationNumScope.TEST_PLAN_API_SCENARIO);
|
||||
|
||||
/**
|
||||
* @param prefix 前缀: PROJECT_ID, 或者 PROJECT_ID + "_" + DOMAIN 例如接口用例的前缀为: 100001_12345
|
||||
|
@ -0,0 +1,47 @@
|
||||
package io.metersphere.plan.controller;
|
||||
|
||||
import io.metersphere.plan.dto.LogInsertModule;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
||||
import io.metersphere.plan.service.TestPlanApiCaseService;
|
||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.system.security.CheckOwner;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "测试计划接口用例")
|
||||
@RestController
|
||||
@RequestMapping("/test-plan/api/case")
|
||||
public class TestPlanApiCaseController {
|
||||
|
||||
@Resource
|
||||
private TestPlanApiCaseService testPlanApiCaseService;
|
||||
|
||||
@PostMapping(value = "/association")
|
||||
@Operation(summary = "测试计划接口用例-关联接口用例")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public TestPlanAssociationResponse association(@Validated @RequestBody TestPlanAssociationRequest request) {
|
||||
return testPlanApiCaseService.association(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/api/case/association", HttpMethodConstants.POST.name()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/sort")
|
||||
@Operation(summary = "测试计划接口用例-关联功能用例")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public TestPlanResourceSortResponse sortNode(@Validated @RequestBody ResourceSortRequest request) {
|
||||
return testPlanApiCaseService.sortNode(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/api/case/sort", HttpMethodConstants.POST.name()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package io.metersphere.plan.controller;
|
||||
|
||||
import io.metersphere.plan.dto.LogInsertModule;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
||||
import io.metersphere.plan.service.TestPlanApiScenarioService;
|
||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.system.security.CheckOwner;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "测试计划场景用例")
|
||||
@RestController
|
||||
@RequestMapping("/test-plan/api/scenario")
|
||||
public class TestPlanApiScenarioController {
|
||||
|
||||
@Resource
|
||||
private TestPlanApiScenarioService testPlanApiScenarioService;
|
||||
|
||||
@PostMapping(value = "/association")
|
||||
@Operation(summary = "测试计划场景用例-关联接口用例")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public TestPlanAssociationResponse association(@Validated @RequestBody TestPlanAssociationRequest request) {
|
||||
return testPlanApiScenarioService.association(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/api/scenario/association", HttpMethodConstants.POST.name()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/sort")
|
||||
@Operation(summary = "测试计划场景用例-关联功能用例")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public TestPlanResourceSortResponse sortNode(@Validated @RequestBody ResourceSortRequest request) {
|
||||
return testPlanApiScenarioService.sortNode(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/api/scenario/sort", HttpMethodConstants.POST.name()));
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package io.metersphere.plan.controller;
|
||||
|
||||
import io.metersphere.plan.dto.LogInsertModule;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
@ -10,6 +11,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.system.security.CheckOwner;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "测试计划功能用例")
|
||||
@RequestMapping("/test-plan/functional/case")
|
||||
public class TestPlanFunctionalCaseController {
|
||||
|
||||
@ -26,19 +29,19 @@ public class TestPlanFunctionalCaseController {
|
||||
private TestPlanFunctionalCaseService testPlanFunctionalCaseService;
|
||||
|
||||
@PostMapping(value = "/association")
|
||||
@Operation(summary = "测试计划-关联功能用例")
|
||||
@Operation(summary = "测试计划功能用例-关联功能用例")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public TestPlanAssociationResponse association(@Validated @RequestBody TestPlanAssociationRequest request) {
|
||||
return testPlanFunctionalCaseService.association(request, SessionUtils.getUserId(), "/test-plan/functional/case/association", HttpMethodConstants.POST.name());
|
||||
return testPlanFunctionalCaseService.association(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/functional/case/association", HttpMethodConstants.POST.name()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/sort")
|
||||
@Operation(summary = "测试计划-关联功能用例")
|
||||
@Operation(summary = "测试计划功能用例-关联功能用例")
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_UPDATE)
|
||||
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
|
||||
public TestPlanResourceSortResponse sortNode(@Validated @RequestBody ResourceSortRequest request) {
|
||||
return testPlanFunctionalCaseService.sortNode(request, SessionUtils.getUserId(), "/test-plan/functional/case/sort", HttpMethodConstants.POST.name());
|
||||
return testPlanFunctionalCaseService.sortNode(request, new LogInsertModule(SessionUtils.getUserId(), "/test-plan/functional/case/sort", HttpMethodConstants.POST.name()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package io.metersphere.plan.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
//用于记录模块的DTO
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LogInsertModule {
|
||||
@NotBlank
|
||||
private String operator;
|
||||
@NotBlank
|
||||
private String requestUrl;
|
||||
@NotBlank
|
||||
private String requestMethod;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package io.metersphere.plan.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResourceLogInsertModule extends LogInsertModule {
|
||||
@NotBlank
|
||||
private String resourceType;
|
||||
|
||||
public ResourceLogInsertModule(String resourceType, LogInsertModule logInsertModule) {
|
||||
this.resourceType = resourceType;
|
||||
this.setOperator(logInsertModule.getOperator());
|
||||
this.setRequestUrl(logInsertModule.getRequestUrl());
|
||||
this.setRequestMethod(logInsertModule.getRequestMethod());
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package io.metersphere.plan.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ResourceSelectParam {
|
||||
private String testPlanId;
|
||||
private List<String> selectIds;
|
||||
private List<String> moduleIds;
|
||||
private boolean repeatCase;
|
||||
private String orderString;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package io.metersphere.plan.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class TestPlanResourceAssociationParam {
|
||||
@NotEmpty
|
||||
private List<String> resourceIdList;
|
||||
@NotBlank
|
||||
private String projectId;
|
||||
@NotBlank
|
||||
private String testPlanId;
|
||||
@NotBlank
|
||||
private Long testPlanNum;
|
||||
@NotBlank
|
||||
private String operator;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package io.metersphere.plan.mapper;
|
||||
|
||||
import io.metersphere.plan.dto.AssociationNode;
|
||||
import io.metersphere.plan.dto.ResourceSelectParam;
|
||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtTestPlanApiCaseMapper {
|
||||
|
||||
long updatePos(@Param("id") String id, @Param("pos") long pos);
|
||||
|
||||
List<String> selectIdByTestPlanIdOrderByPos(String testPlanId);
|
||||
|
||||
Long getMaxPosByTestPlanId(String testPlanId);
|
||||
|
||||
List<String> getIdByIds(ResourceSelectParam resourceSelectParam);
|
||||
|
||||
List<String> getIdByModuleIds(ResourceSelectParam resourceSelectParam);
|
||||
|
||||
AssociationNode selectDragInfoById(String id);
|
||||
|
||||
AssociationNode selectNodeByPosOperator(NodeSortQueryParam nodeSortQueryParam);
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?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.plan.mapper.ExtTestPlanApiCaseMapper">
|
||||
<update id="updatePos">
|
||||
UPDATE
|
||||
test_plan_api_case
|
||||
SET pos =#{pos}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<select id="selectIdByTestPlanIdOrderByPos" resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE test_plan_id = #{testPlanId}
|
||||
ORDER BY pos ASC
|
||||
</select>
|
||||
<select id="getMaxPosByTestPlanId" resultType="java.lang.Long">
|
||||
SELECT max(pos)
|
||||
FROM test_plan_api_case
|
||||
WHERE test_plan_id = #{0}
|
||||
</select>
|
||||
<select id="getIdByIds"
|
||||
parameterType="io.metersphere.plan.dto.ResourceSelectParam"
|
||||
resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM api_test_case
|
||||
WHERE deleted = false
|
||||
AND id IN
|
||||
<foreach collection="selectIds" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="repeatCase == false">
|
||||
AND id NOT IN
|
||||
(SELECT api_case_id FROM test_plan_api_case WHERE test_plan_id = #{testPlanId})
|
||||
</if>
|
||||
<if test="orderString != null ">
|
||||
ORDER BY #{orderString}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getIdByModuleIds"
|
||||
parameterType="io.metersphere.plan.dto.ResourceSelectParam"
|
||||
resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM api_test_case
|
||||
WHERE deleted = false
|
||||
AND module_id IN
|
||||
<foreach collection="moduleIds" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="repeatCase == false">
|
||||
AND id NOT IN
|
||||
(SELECT api_case_id FROM test_plan_api_case WHERE test_plan_id = #{testPlanId})
|
||||
</if>
|
||||
<if test="orderString != null ">
|
||||
ORDER BY #{orderString}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectDragInfoById" resultType="io.metersphere.plan.dto.AssociationNode">
|
||||
SELECT id, pos
|
||||
FROM test_plan_api_case
|
||||
WHERE id = #{0}
|
||||
</select>
|
||||
<select id="selectNodeByPosOperator"
|
||||
parameterType="io.metersphere.project.dto.NodeSortQueryParam"
|
||||
resultType="io.metersphere.plan.dto.AssociationNode">
|
||||
SELECT id, pos
|
||||
FROM test_plan_api_case
|
||||
WHERE test_plan_id = #{parentId}
|
||||
<if test="operator == 'moreThan'">
|
||||
AND pos > #{pos}
|
||||
</if>
|
||||
<if test="operator == 'lessThan'">
|
||||
AND pos < #{pos}
|
||||
</if>
|
||||
ORDER BY pos
|
||||
<if test="operator == 'lessThan' or operator == 'latest'">
|
||||
DESC
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,25 @@
|
||||
package io.metersphere.plan.mapper;
|
||||
|
||||
import io.metersphere.plan.dto.AssociationNode;
|
||||
import io.metersphere.plan.dto.ResourceSelectParam;
|
||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtTestPlanApiScenarioMapper {
|
||||
|
||||
long updatePos(@Param("id") String id, @Param("pos") long pos);
|
||||
|
||||
List<String> selectIdByTestPlanIdOrderByPos(String testPlanId);
|
||||
|
||||
Long getMaxPosByTestPlanId(String testPlanId);
|
||||
|
||||
List<String> getIdByIds(ResourceSelectParam resourceSelectParam);
|
||||
|
||||
List<String> getIdByModuleIds(ResourceSelectParam resourceSelectParam);
|
||||
|
||||
AssociationNode selectDragInfoById(String id);
|
||||
|
||||
AssociationNode selectNodeByPosOperator(NodeSortQueryParam nodeSortQueryParam);
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?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.plan.mapper.ExtTestPlanApiScenarioMapper">
|
||||
<update id="updatePos">
|
||||
UPDATE
|
||||
test_plan_api_scenario
|
||||
SET pos =#{pos}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<select id="selectIdByTestPlanIdOrderByPos" resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM test_plan_api_scenario
|
||||
WHERE test_plan_id = #{testPlanId}
|
||||
ORDER BY pos ASC
|
||||
</select>
|
||||
<select id="getMaxPosByTestPlanId" resultType="java.lang.Long">
|
||||
SELECT max(pos)
|
||||
FROM test_plan_api_scenario
|
||||
WHERE test_plan_id = #{0}
|
||||
</select>
|
||||
<select id="getIdByIds"
|
||||
parameterType="io.metersphere.plan.dto.ResourceSelectParam"
|
||||
resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM api_scenario
|
||||
WHERE deleted = false
|
||||
AND id IN
|
||||
<foreach collection="selectIds" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="repeatCase == false">
|
||||
AND id NOT IN
|
||||
(SELECT api_scenario_id FROM test_plan_api_scenario WHERE test_plan_id = #{testPlanId})
|
||||
</if>
|
||||
<if test="orderString != null ">
|
||||
ORDER BY #{orderString}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getIdByModuleIds"
|
||||
parameterType="io.metersphere.plan.dto.ResourceSelectParam"
|
||||
resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM api_scenario
|
||||
WHERE deleted = false
|
||||
AND module_id IN
|
||||
<foreach collection="moduleIds" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="repeatCase == false">
|
||||
AND id NOT IN
|
||||
(SELECT api_scenario_id FROM test_plan_api_scenario WHERE test_plan_id = #{testPlanId})
|
||||
</if>
|
||||
<if test="orderString != null ">
|
||||
ORDER BY #{orderString}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectDragInfoById" resultType="io.metersphere.plan.dto.AssociationNode">
|
||||
SELECT id, pos
|
||||
FROM test_plan_api_scenario
|
||||
WHERE id = #{0}
|
||||
</select>
|
||||
<select id="selectNodeByPosOperator"
|
||||
parameterType="io.metersphere.project.dto.NodeSortQueryParam"
|
||||
resultType="io.metersphere.plan.dto.AssociationNode">
|
||||
SELECT id, pos
|
||||
FROM test_plan_api_scenario
|
||||
WHERE test_plan_id = #{parentId}
|
||||
<if test="operator == 'moreThan'">
|
||||
AND pos > #{pos}
|
||||
</if>
|
||||
<if test="operator == 'lessThan'">
|
||||
AND pos < #{pos}
|
||||
</if>
|
||||
ORDER BY pos
|
||||
<if test="operator == 'lessThan' or operator == 'latest'">
|
||||
DESC
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
@ -1,6 +1,7 @@
|
||||
package io.metersphere.plan.mapper;
|
||||
|
||||
import io.metersphere.plan.dto.AssociationNode;
|
||||
import io.metersphere.plan.dto.ResourceSelectParam;
|
||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -14,9 +15,9 @@ public interface ExtTestPlanFunctionalCaseMapper {
|
||||
|
||||
Long getMaxPosByTestPlanId(String testPlanId);
|
||||
|
||||
List<String> getIdByIds(@Param("selectIds") List<String> selectIds, @Param("testPlanId") String testPlanId, @Param("repeatCase") boolean repeatCase, @Param("orderString") String orderString);
|
||||
List<String> getIdByIds(ResourceSelectParam resourceSelectParam);
|
||||
|
||||
List<String> getIdByModuleIds(@Param("moduleIds") List<String> selectModuleIds, @Param("testPlanId") String testPlanId, @Param("repeatCase") boolean repeatCase, @Param("orderString") String orderString);
|
||||
List<String> getIdByModuleIds(ResourceSelectParam resourceSelectParam);
|
||||
|
||||
AssociationNode selectDragInfoById(String id);
|
||||
|
||||
|
@ -18,7 +18,9 @@
|
||||
FROM test_plan_functional_case
|
||||
WHERE test_plan_id = #{0}
|
||||
</select>
|
||||
<select id="getIdByIds" resultType="java.lang.String">
|
||||
<select id="getIdByIds"
|
||||
parameterType="io.metersphere.plan.dto.ResourceSelectParam"
|
||||
resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM functional_case
|
||||
WHERE deleted = false
|
||||
@ -34,7 +36,9 @@
|
||||
ORDER BY #{orderString}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getIdByModuleIds" resultType="java.lang.String">
|
||||
<select id="getIdByModuleIds"
|
||||
parameterType="io.metersphere.plan.dto.ResourceSelectParam"
|
||||
resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM functional_case
|
||||
WHERE deleted = false
|
||||
|
@ -1,32 +1,136 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanApiCase;
|
||||
import io.metersphere.plan.domain.TestPlanApiCaseExample;
|
||||
import io.metersphere.plan.dto.TestPlanApiCaseDTO;
|
||||
import io.metersphere.plan.dto.AssociationNodeSortDTO;
|
||||
import io.metersphere.plan.dto.LogInsertModule;
|
||||
import io.metersphere.plan.dto.ResourceLogInsertModule;
|
||||
import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
||||
import io.metersphere.plan.mapper.ExtTestPlanApiCaseMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanApiCaseMapper;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.sdk.constants.ApplicationNumScope;
|
||||
import io.metersphere.sdk.constants.TestPlanResourceConstants;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import io.metersphere.system.uid.NumGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestPlanApiCaseService {
|
||||
|
||||
public class TestPlanApiCaseService extends TestPlanResourceService {
|
||||
@Resource
|
||||
TestPlanApiCaseMapper testPlanApiCaseMapper;
|
||||
|
||||
public int deleteByTestPlanId(String testPlanId) {
|
||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(testPlanId);
|
||||
return testPlanApiCaseMapper.deleteByExample(example);
|
||||
}
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private TestPlanApiCaseMapper testPlanApiCaseMapper;
|
||||
@Resource
|
||||
private ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
|
||||
@Resource
|
||||
private TestPlanConfigMapper testPlanConfigMapper;
|
||||
@Resource
|
||||
private TestPlanResourceLogService testPlanResourceLogService;
|
||||
@Resource
|
||||
private TestPlanMapper testPlanMapper;
|
||||
|
||||
@Override
|
||||
public int deleteBatchByTestPlanId(List<String> testPlanIdList) {
|
||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||
example.createCriteria().andTestPlanIdIn(testPlanIdList);
|
||||
return testPlanApiCaseMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNextOrder(String testPlanId) {
|
||||
Long maxPos = extTestPlanApiCaseMapper.getMaxPosByTestPlanId(testPlanId);
|
||||
if (maxPos == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return maxPos + DEFAULT_NODE_INTERVAL_POS;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePos(String id, long pos) {
|
||||
extTestPlanApiCaseMapper.updatePos(id, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshPos(String testPlanId) {
|
||||
List<String> caseIdList = extTestPlanApiCaseMapper.selectIdByTestPlanIdOrderByPos(testPlanId);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ExtTestPlanApiCaseMapper batchUpdateMapper = sqlSession.getMapper(ExtTestPlanApiCaseMapper.class);
|
||||
for (int i = 0; i < caseIdList.size(); i++) {
|
||||
batchUpdateMapper.updatePos(caseIdList.get(i), i * DEFAULT_NODE_INTERVAL_POS);
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
}
|
||||
|
||||
public TestPlanAssociationResponse association(TestPlanAssociationRequest request, LogInsertModule logInsertModule) {
|
||||
return super.association(
|
||||
TestPlanResourceConstants.RESOURCE_API_CASE,
|
||||
request,
|
||||
logInsertModule,
|
||||
extTestPlanApiCaseMapper::getIdByIds,
|
||||
extTestPlanApiCaseMapper::getIdByModuleIds,
|
||||
this::saveTestPlanResource);
|
||||
}
|
||||
|
||||
private void saveTestPlanResource(@Validated TestPlanResourceAssociationParam associationParam) {
|
||||
long pox = this.getNextOrder(associationParam.getTestPlanId());
|
||||
long now = System.currentTimeMillis();
|
||||
List<TestPlanApiCase> testPlanResourceList = new ArrayList<>();
|
||||
List<String> associationIdList = associationParam.getResourceIdList();
|
||||
for (int i = 0; i < associationIdList.size(); i++) {
|
||||
TestPlanApiCase testPlanResourceCase = new TestPlanApiCase();
|
||||
testPlanResourceCase.setId(IDGenerator.nextStr());
|
||||
testPlanResourceCase.setNum(NumGenerator.nextNum(associationParam.getTestPlanNum() + "_" + associationParam.getProjectId(), ApplicationNumScope.TEST_PLAN_API_CASE));
|
||||
testPlanResourceCase.setTestPlanId(associationParam.getTestPlanId());
|
||||
testPlanResourceCase.setApiCaseId(associationIdList.get(i));
|
||||
testPlanResourceCase.setPos(pox + (i + 1) * DEFAULT_NODE_INTERVAL_POS);
|
||||
testPlanResourceCase.setCreateTime(now);
|
||||
testPlanResourceCase.setCreateUser(associationParam.getOperator());
|
||||
testPlanResourceCase.setExecuteUser(associationParam.getOperator());
|
||||
testPlanResourceList.add(testPlanResourceCase);
|
||||
}
|
||||
testPlanApiCaseMapper.batchInsert(testPlanResourceList);
|
||||
}
|
||||
|
||||
public TestPlanResourceSortResponse sortNode(ResourceSortRequest request, LogInsertModule logInsertModule) {
|
||||
TestPlanResourceSortResponse response = new TestPlanResourceSortResponse();
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
TestPlanApiCase dragNode = testPlanApiCaseMapper.selectByPrimaryKey(request.getDragNodeId());
|
||||
if (dragNode == null && testPlan == null) {
|
||||
throw new MSException("test_plan.drag.node.error");
|
||||
}
|
||||
if (request.getDropPosition() == -1 || request.getDropPosition() == 1) {
|
||||
AssociationNodeSortDTO sortDTO = super.getNodeSortDTO(
|
||||
request,
|
||||
extTestPlanApiCaseMapper::selectDragInfoById,
|
||||
extTestPlanApiCaseMapper::selectNodeByPosOperator
|
||||
);
|
||||
this.sort(sortDTO);
|
||||
response.setSortNodeNum(1);
|
||||
testPlanResourceLogService.saveSortLog(testPlan, request.getDragNodeId(), new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_API_CASE, logInsertModule));
|
||||
} else {
|
||||
throw new MSException("test_plan.drag.position.error");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +1,133 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanApiScenario;
|
||||
import io.metersphere.plan.domain.TestPlanApiScenarioExample;
|
||||
import io.metersphere.plan.mapper.TestPlanApiScenarioMapper;
|
||||
import io.metersphere.plan.dto.AssociationNodeSortDTO;
|
||||
import io.metersphere.plan.dto.LogInsertModule;
|
||||
import io.metersphere.plan.dto.ResourceLogInsertModule;
|
||||
import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
||||
import io.metersphere.plan.mapper.*;
|
||||
import io.metersphere.sdk.constants.ApplicationNumScope;
|
||||
import io.metersphere.sdk.constants.TestPlanResourceConstants;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import io.metersphere.system.uid.NumGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestPlanApiScenarioService {
|
||||
public class TestPlanApiScenarioService extends TestPlanResourceService {
|
||||
@Resource
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
private ExtTestPlanApiScenarioMapper extTestPlanApiScenarioMapper;
|
||||
@Resource
|
||||
private TestPlanConfigMapper testPlanConfigMapper;
|
||||
@Resource
|
||||
private TestPlanResourceLogService testPlanResourceLogService;
|
||||
@Resource
|
||||
private TestPlanMapper testPlanMapper;
|
||||
|
||||
public int deleteByTestPlanId(String testPlanId) {
|
||||
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(testPlanId);
|
||||
return testPlanApiScenarioMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatchByTestPlanId(List<String> testPlanIdList) {
|
||||
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||
example.createCriteria().andTestPlanIdIn(testPlanIdList);
|
||||
return testPlanApiScenarioMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNextOrder(String testPlanId) {
|
||||
Long maxPos = extTestPlanApiScenarioMapper.getMaxPosByTestPlanId(testPlanId);
|
||||
if (maxPos == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return maxPos + DEFAULT_NODE_INTERVAL_POS;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePos(String id, long pos) {
|
||||
extTestPlanApiScenarioMapper.updatePos(id, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshPos(String testPlanId) {
|
||||
List<String> caseIdList = extTestPlanApiScenarioMapper.selectIdByTestPlanIdOrderByPos(testPlanId);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ExtTestPlanApiCaseMapper batchUpdateMapper = sqlSession.getMapper(ExtTestPlanApiCaseMapper.class);
|
||||
for (int i = 0; i < caseIdList.size(); i++) {
|
||||
batchUpdateMapper.updatePos(caseIdList.get(i), i * DEFAULT_NODE_INTERVAL_POS);
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
}
|
||||
|
||||
public TestPlanAssociationResponse association(TestPlanAssociationRequest request, LogInsertModule logInsertModule) {
|
||||
return super.association(
|
||||
TestPlanResourceConstants.RESOURCE_API_CASE,
|
||||
request,
|
||||
logInsertModule,
|
||||
extTestPlanApiScenarioMapper::getIdByIds,
|
||||
extTestPlanApiScenarioMapper::getIdByModuleIds,
|
||||
this::saveTestPlanResource);
|
||||
}
|
||||
|
||||
private void saveTestPlanResource(@Validated TestPlanResourceAssociationParam associationParam) {
|
||||
long pox = this.getNextOrder(associationParam.getTestPlanId());
|
||||
long now = System.currentTimeMillis();
|
||||
List<TestPlanApiScenario> testPlanResourceList = new ArrayList<>();
|
||||
List<String> associationIdList = associationParam.getResourceIdList();
|
||||
for (int i = 0; i < associationIdList.size(); i++) {
|
||||
TestPlanApiScenario testPlanResourceCase = new TestPlanApiScenario();
|
||||
testPlanResourceCase.setId(IDGenerator.nextStr());
|
||||
testPlanResourceCase.setNum(NumGenerator.nextNum(associationParam.getTestPlanNum() + "_" + associationParam.getProjectId(), ApplicationNumScope.TEST_PLAN_API_SCENARIO));
|
||||
testPlanResourceCase.setTestPlanId(associationParam.getTestPlanId());
|
||||
testPlanResourceCase.setApiScenarioId(associationIdList.get(i));
|
||||
testPlanResourceCase.setPos(pox + (i + 1) * DEFAULT_NODE_INTERVAL_POS);
|
||||
testPlanResourceCase.setCreateTime(now);
|
||||
testPlanResourceCase.setCreateUser(associationParam.getOperator());
|
||||
testPlanResourceCase.setExecuteUser(associationParam.getOperator());
|
||||
testPlanResourceList.add(testPlanResourceCase);
|
||||
}
|
||||
testPlanApiScenarioMapper.batchInsert(testPlanResourceList);
|
||||
}
|
||||
|
||||
public TestPlanResourceSortResponse sortNode(ResourceSortRequest request, LogInsertModule logInsertModule) {
|
||||
TestPlanResourceSortResponse response = new TestPlanResourceSortResponse();
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
TestPlanApiScenario dragNode = testPlanApiScenarioMapper.selectByPrimaryKey(request.getDragNodeId());
|
||||
if (dragNode == null && testPlan == null) {
|
||||
throw new MSException("test_plan.drag.node.error");
|
||||
}
|
||||
if (request.getDropPosition() == -1 || request.getDropPosition() == 1) {
|
||||
AssociationNodeSortDTO sortDTO = super.getNodeSortDTO(
|
||||
request,
|
||||
extTestPlanApiScenarioMapper::selectDragInfoById,
|
||||
extTestPlanApiScenarioMapper::selectNodeByPosOperator
|
||||
);
|
||||
this.sort(sortDTO);
|
||||
response.setSortNodeNum(1);
|
||||
testPlanResourceLogService.saveSortLog(testPlan, request.getDragNodeId(), new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_API_CASE, logInsertModule));
|
||||
} else {
|
||||
throw new MSException("test_plan.drag.position.error");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlanBugExample;
|
||||
import io.metersphere.plan.mapper.TestPlanBugMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestPlanBugService extends TestPlanResourceService {
|
||||
@Resource
|
||||
private TestPlanBugMapper testPlanBugMapper;
|
||||
|
||||
@Override
|
||||
public int deleteBatchByTestPlanId(List<String> testPlanIdList) {
|
||||
if (CollectionUtils.isEmpty(testPlanIdList)) {
|
||||
return 0;
|
||||
}
|
||||
TestPlanBugExample example = new TestPlanBugExample();
|
||||
example.createCriteria().andTestPlanIdIn(testPlanIdList);
|
||||
return testPlanBugMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNextOrder(String testPlanId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePos(String id, long pos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshPos(String testPlanId) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanConfig;
|
||||
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
||||
import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
|
||||
import io.metersphere.plan.dto.AssociationNodeSortDTO;
|
||||
import io.metersphere.plan.dto.LogInsertModule;
|
||||
import io.metersphere.plan.dto.ResourceLogInsertModule;
|
||||
import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
@ -13,17 +15,19 @@ import io.metersphere.plan.mapper.ExtTestPlanFunctionalCaseMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.sdk.constants.ApplicationNumScope;
|
||||
import io.metersphere.sdk.constants.TestPlanResourceConstants;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import io.metersphere.system.uid.NumGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -44,6 +48,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||
@Resource
|
||||
private TestPlanMapper testPlanMapper;
|
||||
|
||||
@Override
|
||||
public int deleteBatchByTestPlanId(List<String> testPlanIdList) {
|
||||
TestPlanFunctionalCaseExample example = new TestPlanFunctionalCaseExample();
|
||||
example.createCriteria().andTestPlanIdIn(testPlanIdList);
|
||||
@ -77,73 +82,51 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
}
|
||||
|
||||
public TestPlanAssociationResponse association(TestPlanAssociationRequest request, String operator, String requestUrl, String requestMethod) {
|
||||
TestPlanAssociationResponse response = new TestPlanAssociationResponse();
|
||||
if (request.isEmpty()) {
|
||||
return response;
|
||||
}
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
boolean repeatCase = testPlanConfig.getRepeatCase();
|
||||
List<String> associationIdList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(request.getSelectIds())) {
|
||||
//获取有效ID
|
||||
associationIdList.addAll(extTestPlanFunctionalCaseMapper.getIdByIds(request.getSelectIds(), request.getTestPlanId(), repeatCase, request.getOrderString()));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(request.getSelectModuleIds())) {
|
||||
//获取有效ID
|
||||
associationIdList.addAll(extTestPlanFunctionalCaseMapper.getIdByModuleIds(request.getSelectModuleIds(), request.getTestPlanId(), repeatCase, request.getOrderString()));
|
||||
}
|
||||
associationIdList = new ArrayList<>(associationIdList.stream().distinct().toList());
|
||||
associationIdList.removeAll(request.getExcludeIds());
|
||||
|
||||
this.saveTestPlanResource(associationIdList, request.getTestPlanId(), operator);
|
||||
response.setAssociationCount(associationIdList.size());
|
||||
|
||||
testPlanResourceLogService.saveAddLog(testPlan, TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, operator, requestUrl, requestMethod);
|
||||
return response;
|
||||
public TestPlanAssociationResponse association(TestPlanAssociationRequest request, LogInsertModule logInsertModule) {
|
||||
return super.association(
|
||||
TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE,
|
||||
request,
|
||||
logInsertModule,
|
||||
extTestPlanFunctionalCaseMapper::getIdByIds,
|
||||
extTestPlanFunctionalCaseMapper::getIdByModuleIds,
|
||||
this::saveTestPlanResource);
|
||||
}
|
||||
|
||||
private void saveTestPlanResource(List<String> associationIdList, String testPlanId, String operator) {
|
||||
if (CollectionUtils.isEmpty(associationIdList)) {
|
||||
return;
|
||||
}
|
||||
long pox = this.getNextOrder(testPlanId);
|
||||
private void saveTestPlanResource(@Validated TestPlanResourceAssociationParam associationParam) {
|
||||
long pox = this.getNextOrder(associationParam.getTestPlanId());
|
||||
long now = System.currentTimeMillis();
|
||||
List<TestPlanFunctionalCase> testPlanFunctionalCaseList = new ArrayList<>();
|
||||
List<String> associationIdList = associationParam.getResourceIdList();
|
||||
for (int i = 0; i < associationIdList.size(); i++) {
|
||||
TestPlanFunctionalCase testPlanFunctionalCase = new TestPlanFunctionalCase();
|
||||
testPlanFunctionalCase.setId(IDGenerator.nextStr());
|
||||
testPlanFunctionalCase.setTestPlanId(testPlanId);
|
||||
testPlanFunctionalCase.setNum(NumGenerator.nextNum(associationParam.getTestPlanNum() + "_" + associationParam.getProjectId(), ApplicationNumScope.TEST_PLAN_FUNCTION_CASE));
|
||||
testPlanFunctionalCase.setTestPlanId(associationParam.getTestPlanId());
|
||||
testPlanFunctionalCase.setFunctionalCaseId(associationIdList.get(i));
|
||||
testPlanFunctionalCase.setPos(pox + (i + 1) * DEFAULT_NODE_INTERVAL_POS);
|
||||
testPlanFunctionalCase.setCreateTime(now);
|
||||
testPlanFunctionalCase.setCreateUser(operator);
|
||||
testPlanFunctionalCase.setExecuteUser(operator);
|
||||
testPlanFunctionalCase.setCreateUser(associationParam.getOperator());
|
||||
testPlanFunctionalCase.setExecuteUser(associationParam.getOperator());
|
||||
testPlanFunctionalCaseList.add(testPlanFunctionalCase);
|
||||
}
|
||||
testPlanFunctionalCaseMapper.batchInsert(testPlanFunctionalCaseList);
|
||||
}
|
||||
|
||||
public TestPlanResourceSortResponse sortNode(ResourceSortRequest request, String userId, String requestUrl, String requestMethod) {
|
||||
TestPlanResourceSortResponse response = new TestPlanResourceSortResponse();
|
||||
if (request.getDropPosition() == -1 || request.getDropPosition() == 1) {
|
||||
TestPlanFunctionalCase dragNode = testPlanFunctionalCaseMapper.selectByPrimaryKey(request.getDragNodeId());
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
if (dragNode == null && testPlan == null) {
|
||||
throw new MSException("test_plan.drag.node.error");
|
||||
}
|
||||
AssociationNodeSortDTO sortDTO = super.getNodeSortDTO(
|
||||
request,
|
||||
extTestPlanFunctionalCaseMapper::selectDragInfoById,
|
||||
extTestPlanFunctionalCaseMapper::selectNodeByPosOperator
|
||||
);
|
||||
this.sort(sortDTO);
|
||||
response.setSortNodeNum(1);
|
||||
testPlanResourceLogService.saveSortLog(testPlan, request.getDragNodeId(), TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, userId, requestUrl, requestMethod);
|
||||
} else {
|
||||
throw new MSException("test_plan.drag.position.error");
|
||||
public TestPlanResourceSortResponse sortNode(ResourceSortRequest request, LogInsertModule logInsertModule) {
|
||||
TestPlanFunctionalCase dragNode = testPlanFunctionalCaseMapper.selectByPrimaryKey(request.getDragNodeId());
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
if (dragNode == null && testPlan == null) {
|
||||
throw new MSException("test_plan.drag.node.error");
|
||||
}
|
||||
TestPlanResourceSortResponse response = new TestPlanResourceSortResponse();
|
||||
AssociationNodeSortDTO sortDTO = super.getNodeSortDTO(
|
||||
request,
|
||||
extTestPlanFunctionalCaseMapper::selectDragInfoById,
|
||||
extTestPlanFunctionalCaseMapper::selectNodeByPosOperator
|
||||
);
|
||||
super.sort(sortDTO);
|
||||
response.setSortNodeNum(1);
|
||||
testPlanResourceLogService.saveSortLog(testPlan, request.getDragNodeId(), new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, logInsertModule));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.dto.ResourceLogInsertModule;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.project.mapper.ProjectMapper;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
@ -13,6 +14,7 @@ import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -37,50 +39,50 @@ public class TestPlanResourceLogService {
|
||||
return content.toString();
|
||||
}
|
||||
|
||||
public void saveAddLog(TestPlan module, String resourceType, String operator, String requestUrl, String requestMethod) {
|
||||
public void saveAddLog(TestPlan module, @Validated ResourceLogInsertModule logInsertModule) {
|
||||
Project project = projectMapper.selectByPrimaryKey(module.getProjectId());
|
||||
LogDTO dto = LogDTOBuilder.builder()
|
||||
.projectId(module.getProjectId())
|
||||
.organizationId(project.getOrganizationId())
|
||||
.type(OperationLogType.ADD.name())
|
||||
.module(logModule)
|
||||
.method(requestMethod)
|
||||
.path(requestUrl)
|
||||
.method(logInsertModule.getRequestMethod())
|
||||
.path(logInsertModule.getRequestUrl())
|
||||
.sourceId(module.getId())
|
||||
.content(generateContent(module.getName(), resourceType, "add"))
|
||||
.createUser(operator)
|
||||
.content(generateContent(module.getName(), logInsertModule.getResourceType(), "add"))
|
||||
.createUser(logInsertModule.getOperator())
|
||||
.build().getLogDTO();
|
||||
operationLogService.add(dto);
|
||||
}
|
||||
|
||||
public void saveDeleteLog(TestPlan module, String resourceType, String operator, String requestUrl, String requestMethod) {
|
||||
public void saveDeleteLog(TestPlan module, @Validated ResourceLogInsertModule logInsertModule) {
|
||||
Project project = projectMapper.selectByPrimaryKey(module.getProjectId());
|
||||
LogDTO dto = LogDTOBuilder.builder()
|
||||
.projectId(module.getProjectId())
|
||||
.organizationId(project.getOrganizationId())
|
||||
.type(OperationLogType.DELETE.name())
|
||||
.module(logModule)
|
||||
.method(requestMethod)
|
||||
.path(requestUrl)
|
||||
.method(logInsertModule.getRequestMethod())
|
||||
.path(logInsertModule.getRequestUrl())
|
||||
.sourceId(module.getId())
|
||||
.content(generateContent(module.getName(), resourceType, "remove"))
|
||||
.createUser(operator)
|
||||
.content(generateContent(module.getName(), logInsertModule.getResourceType(), "remove"))
|
||||
.createUser(logInsertModule.getOperator())
|
||||
.build().getLogDTO();
|
||||
operationLogService.add(dto);
|
||||
}
|
||||
|
||||
public void saveSortLog(TestPlan testPlan, String resourceId, String resourceType, String operator, String requestUrl, String requestMethod) {
|
||||
public void saveSortLog(TestPlan testPlan, String resourceId, @Validated ResourceLogInsertModule logInsertModule) {
|
||||
Project project = projectMapper.selectByPrimaryKey(testPlan.getProjectId());
|
||||
LogDTO dto = LogDTOBuilder.builder()
|
||||
.projectId(testPlan.getProjectId())
|
||||
.organizationId(project.getOrganizationId())
|
||||
.type(OperationLogType.UPDATE.name())
|
||||
.module(logModule)
|
||||
.method(requestMethod)
|
||||
.path(requestUrl)
|
||||
.method(logInsertModule.getRequestMethod())
|
||||
.path(logInsertModule.getRequestUrl())
|
||||
.sourceId(resourceId)
|
||||
.content(generateContent(testPlan.getName(), resourceType, "move"))
|
||||
.createUser(operator)
|
||||
.content(generateContent(testPlan.getName(), logInsertModule.getResourceType(), "move"))
|
||||
.createUser(logInsertModule.getOperator())
|
||||
.build().getLogDTO();
|
||||
operationLogService.add(dto);
|
||||
}
|
||||
|
@ -1,18 +1,28 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.plan.dto.AssociationNode;
|
||||
import io.metersphere.plan.dto.AssociationNodeSortDTO;
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanConfig;
|
||||
import io.metersphere.plan.dto.*;
|
||||
import io.metersphere.plan.dto.request.ResourceSortRequest;
|
||||
import io.metersphere.plan.dto.request.TestPlanAssociationRequest;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.project.dto.ModuleSortCountResultDTO;
|
||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||
import io.metersphere.project.utils.NodeSortUtils;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
//测试计划关联表 通用方法
|
||||
@ -20,6 +30,13 @@ import java.util.function.Function;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public abstract class TestPlanResourceService {
|
||||
|
||||
@Resource
|
||||
private TestPlanMapper testPlanMapper;
|
||||
@Resource
|
||||
private TestPlanConfigMapper testPlanConfigMapper;
|
||||
@Resource
|
||||
private TestPlanResourceLogService testPlanResourceLogService;
|
||||
|
||||
protected static final long DEFAULT_NODE_INTERVAL_POS = NodeSortUtils.DEFAULT_NODE_INTERVAL_POS;
|
||||
|
||||
public abstract long getNextOrder(String testPlanId);
|
||||
@ -32,9 +49,51 @@ public abstract class TestPlanResourceService {
|
||||
|
||||
private static final String MOVE_POS_OPERATOR_LESS = "lessThan";
|
||||
private static final String MOVE_POS_OPERATOR_MORE = "moreThan";
|
||||
private static final String MOVE_POS_OPERATOR_LATEST = "latest";
|
||||
private static final String DRAG_NODE_NOT_EXIST = "drag_node.not.exist";
|
||||
|
||||
/**
|
||||
* 关联资源od
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TestPlanAssociationResponse association(
|
||||
String resourceType,
|
||||
TestPlanAssociationRequest request,
|
||||
@Validated LogInsertModule logInsertModule,
|
||||
Function<ResourceSelectParam, List<String>> selectByResourceIdFunc,
|
||||
Function<ResourceSelectParam, List<String>> selectByModuleIdFunc,
|
||||
Consumer<TestPlanResourceAssociationParam> saveResourceFunc) {
|
||||
TestPlanAssociationResponse response = new TestPlanAssociationResponse();
|
||||
if (request.isEmpty()) {
|
||||
return response;
|
||||
}
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(request.getTestPlanId());
|
||||
boolean repeatCase = testPlanConfig.getRepeatCase();
|
||||
List<String> associationIdList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(request.getSelectIds())) {
|
||||
//获取有效ID
|
||||
associationIdList.addAll(
|
||||
selectByResourceIdFunc.apply(
|
||||
new ResourceSelectParam(request.getTestPlanId(), request.getSelectIds(), null, repeatCase, request.getOrderString())));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(request.getSelectModuleIds())) {
|
||||
//获取有效ID
|
||||
associationIdList.addAll(
|
||||
selectByModuleIdFunc.apply(
|
||||
new ResourceSelectParam(request.getTestPlanId(), null, request.getSelectModuleIds(), repeatCase, request.getOrderString())));
|
||||
}
|
||||
associationIdList = new ArrayList<>(associationIdList.stream().distinct().toList());
|
||||
associationIdList.removeAll(request.getExcludeIds());
|
||||
if (CollectionUtils.isNotEmpty(associationIdList)) {
|
||||
TestPlanResourceAssociationParam associationParam = new TestPlanResourceAssociationParam(associationIdList, testPlan.getProjectId(), testPlan.getId(), testPlan.getNum(), logInsertModule.getOperator());
|
||||
saveResourceFunc.accept(associationParam);
|
||||
response.setAssociationCount(associationIdList.size());
|
||||
testPlanResourceLogService.saveAddLog(testPlan, new ResourceLogInsertModule(resourceType, logInsertModule));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建节点排序的参数
|
||||
*
|
||||
@ -59,8 +118,8 @@ public abstract class TestPlanResourceService {
|
||||
throw new MSException(Translator.get(DRAG_NODE_NOT_EXIST) + ":" + request.getDropNodeId());
|
||||
}
|
||||
|
||||
AssociationNode previousNode = null;
|
||||
AssociationNode nextNode = null;
|
||||
AssociationNode previousNode;
|
||||
AssociationNode nextNode;
|
||||
|
||||
if (request.getDropPosition() == 1) {
|
||||
//dropPosition=1: 放到dropNode节点后,原dropNode后面的节点之前
|
||||
@ -102,4 +161,5 @@ public abstract class TestPlanResourceService {
|
||||
refreshPos(sortDTO.getTestPlanId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,10 +77,10 @@
|
||||
<!-- typeHandler="io.metersphere.handler.ListTypeHandler"/>-->
|
||||
<!-- </table>-->
|
||||
|
||||
<!-- <table tableName="test_plan_functional_case"/>-->
|
||||
<!-- <table tableName="test_plan_api_case"/>-->
|
||||
<!-- <table tableName="test_plan_api_scenario"/>-->
|
||||
<table tableName="test_plan_follower"/>
|
||||
<table tableName="test_plan_functional_case"/>
|
||||
<table tableName="test_plan_api_case"/>
|
||||
<table tableName="test_plan_api_scenario"/>
|
||||
<table tableName="test_plan_bug"/>
|
||||
<!-- <table tableName="test_plan_config"/>-->
|
||||
<!-- 要忽略的字段-->
|
||||
<!-- <table tableName="test_case">
|
||||
|
@ -1,9 +1,9 @@
|
||||
package io.metersphere.plan.controller;
|
||||
|
||||
import io.metersphere.api.domain.ApiScenario;
|
||||
import io.metersphere.api.domain.ApiTestCase;
|
||||
import io.metersphere.functional.domain.FunctionalCase;
|
||||
import io.metersphere.plan.domain.TestPlan;
|
||||
import io.metersphere.plan.domain.TestPlanConfig;
|
||||
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
||||
import io.metersphere.plan.domain.*;
|
||||
import io.metersphere.plan.dto.request.*;
|
||||
import io.metersphere.plan.dto.response.TestPlanAssociationResponse;
|
||||
import io.metersphere.plan.dto.response.TestPlanResourceSortResponse;
|
||||
@ -86,6 +86,10 @@ public class TestPlanTests extends BaseTest {
|
||||
|
||||
private static final List<FunctionalCase> FUNCTIONAL_CASES = new ArrayList<>();
|
||||
|
||||
private static final List<ApiTestCase> API_TEST_CASES = new ArrayList<>();
|
||||
|
||||
private static final List<ApiScenario> API_SCENARIOS = new ArrayList<>();
|
||||
|
||||
//测试计划模块的url
|
||||
private static final String URL_GET_MODULE_TREE = "/test-plan/module/tree/%s";
|
||||
private static final String URL_GET_MODULE_DELETE = "/test-plan/module/delete/%s";
|
||||
@ -102,6 +106,18 @@ public class TestPlanTests extends BaseTest {
|
||||
private static final String URL_POST_TEST_PLAN_UPDATE = "/test-plan/update";
|
||||
private static final String URL_POST_TEST_PLAN_BATCH_DELETE = "/test-plan/batch-delete";
|
||||
|
||||
//测试计划资源-功能用例
|
||||
private static final String URL_POST_RESOURCE_FUNCTIONAL_CASE_ASSOCIATION = "/test-plan/functional/case/association";
|
||||
private static final String URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT = "/test-plan/functional/case/sort";
|
||||
|
||||
//测试计划资源-接口用例
|
||||
private static final String URL_POST_RESOURCE_API_CASE_ASSOCIATION = "/test-plan/api/case/association";
|
||||
private static final String URL_POST_RESOURCE_API_CASE_SORT = "/test-plan/api/case/sort";
|
||||
|
||||
//测试计划资源-场景用例
|
||||
private static final String URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION = "/test-plan/api/scenario/association";
|
||||
private static final String URL_POST_RESOURCE_API_SCENARIO_SORT = "/test-plan/api/scenario/sort";
|
||||
|
||||
private static String groupTestPlanId7 = null;
|
||||
private static String groupTestPlanId15 = null;
|
||||
|
||||
@ -442,7 +458,7 @@ public class TestPlanTests extends BaseTest {
|
||||
@Test
|
||||
@Order(11)
|
||||
public void testPlanAddTest() throws Exception {
|
||||
this.preliminaryData();
|
||||
this.preliminaryTree();
|
||||
|
||||
BaseTreeNode a1Node = TestPlanTestUtils.getNodeByName(preliminaryTreeNodes, "a1");
|
||||
BaseTreeNode a2Node = TestPlanTestUtils.getNodeByName(preliminaryTreeNodes, "a2");
|
||||
@ -843,8 +859,6 @@ public class TestPlanTests extends BaseTest {
|
||||
this.requestPost(URL_POST_TEST_PLAN_UPDATE, updateRequest).andExpect(status().is5xxServerError());
|
||||
|
||||
}
|
||||
private static final String URL_POST_RESOURCE_FUNCTIONAL_CASE_ASSOCIATION = "/test-plan/functional/case/association";
|
||||
private static final String URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT = "/test-plan/functional/case/sort";
|
||||
|
||||
@Test
|
||||
@Order(21)
|
||||
@ -902,15 +916,15 @@ public class TestPlanTests extends BaseTest {
|
||||
|
||||
//反例 测试计划ID为空
|
||||
request.setTestPlanId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT, request).andExpect(status().isBadRequest());
|
||||
this.requestPost(URL_POST_RESOURCE_FUNCTIONAL_CASE_ASSOCIATION, request).andExpect(status().isBadRequest());
|
||||
//反例 测试计划不存在
|
||||
//测试权限
|
||||
request.setTestPlanId(IDGenerator.nextStr());
|
||||
this.requestPost(URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
this.requestPost(URL_POST_RESOURCE_FUNCTIONAL_CASE_ASSOCIATION, request).andExpect(status().is5xxServerError());
|
||||
|
||||
//测试权限
|
||||
request.setTestPlanId(simpleTestPlan.getId());
|
||||
this.requestPostPermissionTest(PermissionConstants.TEST_PLAN_READ_UPDATE, URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT, request);
|
||||
this.requestPostPermissionTest(PermissionConstants.TEST_PLAN_READ_UPDATE, URL_POST_RESOURCE_FUNCTIONAL_CASE_ASSOCIATION, request);
|
||||
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(simpleTestPlan.getId(), OperationLogType.ADD, URL_POST_RESOURCE_FUNCTIONAL_CASE_ASSOCIATION)
|
||||
@ -990,10 +1004,298 @@ public class TestPlanTests extends BaseTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Order(31)
|
||||
public void testPlanAssociationApiTestCase() throws Exception {
|
||||
this.preliminaryTestPlan();
|
||||
//创建20个功能测试用例
|
||||
API_TEST_CASES.addAll(testPlanTestService.createApiCases(20, project.getId()));
|
||||
//测试不开启用例重复的测试计划多次关联
|
||||
TestPlanAssociationRequest request = new TestPlanAssociationRequest();
|
||||
request.setTestPlanId(simpleTestPlan.getId());
|
||||
request.setSelectIds(API_TEST_CASES.stream().map(ApiTestCase::getId).collect(Collectors.toList()));
|
||||
MvcResult result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_ASSOCIATION, request);
|
||||
ResultHolder resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
TestPlanAssociationResponse response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_TEST_CASES.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_CASE), API_TEST_CASES.size());
|
||||
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), 0);
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_CASE), API_TEST_CASES.size());
|
||||
|
||||
//测试开启用例重复的测试计划多次关联
|
||||
request.setTestPlanId(repeatCaseTestPlan.getId());
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_TEST_CASES.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_CASE), API_TEST_CASES.size() * 1);
|
||||
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_TEST_CASES.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_CASE), API_TEST_CASES.size() * 2);
|
||||
|
||||
//同时测试名称排序
|
||||
request.setOrderColumn("name");
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_TEST_CASES.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_CASE), API_TEST_CASES.size() * 3);
|
||||
|
||||
request.setOrderByAsc(false);
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_TEST_CASES.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_CASE), API_TEST_CASES.size() * 4);
|
||||
|
||||
//反例 测试计划ID为空
|
||||
request.setTestPlanId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT, request).andExpect(status().isBadRequest());
|
||||
//反例 测试计划不存在
|
||||
//测试权限
|
||||
request.setTestPlanId(IDGenerator.nextStr());
|
||||
this.requestPost(URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
|
||||
//测试权限
|
||||
request.setTestPlanId(simpleTestPlan.getId());
|
||||
this.requestPostPermissionTest(PermissionConstants.TEST_PLAN_READ_UPDATE, URL_POST_RESOURCE_FUNCTIONAL_CASE_SORT, request);
|
||||
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(simpleTestPlan.getId(), OperationLogType.ADD, URL_POST_RESOURCE_API_CASE_ASSOCIATION)
|
||||
);
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(repeatCaseTestPlan.getId(), OperationLogType.ADD, URL_POST_RESOURCE_API_CASE_ASSOCIATION)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(32)
|
||||
public void testPlanApiCaseSort() throws Exception {
|
||||
if (API_TEST_CASES.size() == 0) {
|
||||
this.testPlanAssociationFunctionCase();
|
||||
}
|
||||
List<TestPlanApiCase> funcList = testPlanTestService.selectTestPlanApiCaseByTestPlanId(repeatCaseTestPlan.getId());
|
||||
Assertions.assertTrue(funcList.size() >= API_TEST_CASES.size() * 4);
|
||||
//将第80个移动到第一位之前
|
||||
ResourceSortRequest request = new ResourceSortRequest();
|
||||
request.setTestPlanId(repeatCaseTestPlan.getId());
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(funcList.get(0).getId());
|
||||
request.setDropPosition(-1);
|
||||
|
||||
MvcResult result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_SORT, request);
|
||||
ResultHolder resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
TestPlanResourceSortResponse response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanResourceSortResponse.class);
|
||||
Assertions.assertEquals(response.getSortNodeNum(), 1);
|
||||
funcList = testPlanTestService.selectTestPlanApiCaseByTestPlanId(repeatCaseTestPlan.getId());
|
||||
Assertions.assertEquals(funcList.get(0).getId(), request.getDragNodeId());
|
||||
Assertions.assertEquals(funcList.get(1).getId(), request.getDropNodeId());
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(request.getDragNodeId(), OperationLogType.UPDATE, URL_POST_RESOURCE_API_CASE_SORT)
|
||||
);
|
||||
|
||||
//将这时的第80个放到第一位之后
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(funcList.get(0).getId());
|
||||
request.setDropPosition(1);
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_CASE_SORT, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanResourceSortResponse.class);
|
||||
Assertions.assertEquals(response.getSortNodeNum(), 1);
|
||||
funcList = testPlanTestService.selectTestPlanApiCaseByTestPlanId(repeatCaseTestPlan.getId());
|
||||
Assertions.assertEquals(funcList.get(0).getId(), request.getDropNodeId());
|
||||
Assertions.assertEquals(funcList.get(1).getId(), request.getDragNodeId());
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(request.getDragNodeId(), OperationLogType.UPDATE, URL_POST_RESOURCE_API_CASE_SORT)
|
||||
);
|
||||
|
||||
//反例:测试计划为空
|
||||
request.setTestPlanId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_CASE_SORT, request).andExpect(status().isBadRequest());
|
||||
//反例: 测试计划不存在
|
||||
request.setTestPlanId(IDGenerator.nextStr());
|
||||
this.requestPost(URL_POST_RESOURCE_API_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例:拖拽的节点不存在
|
||||
request.setTestPlanId(repeatCaseTestPlan.getId());
|
||||
request.setDragNodeId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例:目标节点不存在
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例: 节点重复
|
||||
request.setDropNodeId(request.getDragNodeId());
|
||||
this.requestPost(URL_POST_RESOURCE_API_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例: dropPosition取值范围不对
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(funcList.get(0).getId());
|
||||
request.setDropPosition(0);
|
||||
this.requestPost(URL_POST_RESOURCE_API_CASE_SORT, request).andExpect(status().is5xxServerError());
|
||||
|
||||
//测试权限
|
||||
request.setDropPosition(1);
|
||||
this.requestPostPermissionTest(PermissionConstants.TEST_PLAN_READ_UPDATE, URL_POST_RESOURCE_API_CASE_SORT, request);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Order(41)
|
||||
public void testPlanAssociationApiScenario() throws Exception {
|
||||
if (ObjectUtils.anyNull(simpleTestPlan, repeatCaseTestPlan)) {
|
||||
this.testPlanAddTest();
|
||||
}
|
||||
//创建20个功能测试用例
|
||||
API_SCENARIOS.addAll(testPlanTestService.createApiScenario(20, project.getId()));
|
||||
|
||||
//测试不开启用例重复的测试计划多次关联
|
||||
TestPlanAssociationRequest request = new TestPlanAssociationRequest();
|
||||
request.setTestPlanId(simpleTestPlan.getId());
|
||||
request.setSelectIds(API_SCENARIOS.stream().map(ApiScenario::getId).collect(Collectors.toList()));
|
||||
MvcResult result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
ResultHolder resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
TestPlanAssociationResponse response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_SCENARIOS.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_SCENARIO), API_SCENARIOS.size());
|
||||
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), 0);
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_SCENARIO), API_SCENARIOS.size());
|
||||
|
||||
//测试开启用例重复的测试计划多次关联
|
||||
request.setTestPlanId(repeatCaseTestPlan.getId());
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_SCENARIOS.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_SCENARIO), API_SCENARIOS.size() * 1);
|
||||
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_SCENARIOS.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_SCENARIO), API_SCENARIOS.size() * 2);
|
||||
|
||||
//同时测试名称排序
|
||||
request.setOrderColumn("name");
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_SCENARIOS.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_SCENARIO), API_SCENARIOS.size() * 3);
|
||||
|
||||
request.setOrderByAsc(false);
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanAssociationResponse.class);
|
||||
Assertions.assertEquals(response.getAssociationCount(), API_SCENARIOS.size());
|
||||
Assertions.assertEquals(testPlanTestService.countResource(request.getTestPlanId(), TestPlanResourceConstants.RESOURCE_API_SCENARIO), API_SCENARIOS.size() * 4);
|
||||
|
||||
//反例 测试计划ID为空
|
||||
request.setTestPlanId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request).andExpect(status().isBadRequest());
|
||||
//反例 测试计划不存在
|
||||
//测试权限
|
||||
request.setTestPlanId(IDGenerator.nextStr());
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request).andExpect(status().is5xxServerError());
|
||||
|
||||
//测试权限
|
||||
request.setTestPlanId(simpleTestPlan.getId());
|
||||
this.requestPostPermissionTest(PermissionConstants.TEST_PLAN_READ_UPDATE, URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION, request);
|
||||
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(simpleTestPlan.getId(), OperationLogType.ADD, URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION)
|
||||
);
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(repeatCaseTestPlan.getId(), OperationLogType.ADD, URL_POST_RESOURCE_API_SCENARIO_ASSOCIATION)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(42)
|
||||
public void testPlanApiScenarioSort() throws Exception {
|
||||
if (API_SCENARIOS.size() == 0) {
|
||||
this.testPlanAssociationFunctionCase();
|
||||
}
|
||||
List<TestPlanApiScenario> funcList = testPlanTestService.selectTestPlanApiScenarioByTestPlanId(repeatCaseTestPlan.getId());
|
||||
Assertions.assertTrue(funcList.size() >= API_SCENARIOS.size() * 4);
|
||||
//将第80个移动到第一位之前
|
||||
ResourceSortRequest request = new ResourceSortRequest();
|
||||
request.setTestPlanId(repeatCaseTestPlan.getId());
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(funcList.get(0).getId());
|
||||
request.setDropPosition(-1);
|
||||
|
||||
MvcResult result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_SORT, request);
|
||||
ResultHolder resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
TestPlanResourceSortResponse response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanResourceSortResponse.class);
|
||||
Assertions.assertEquals(response.getSortNodeNum(), 1);
|
||||
funcList = testPlanTestService.selectTestPlanApiScenarioByTestPlanId(repeatCaseTestPlan.getId());
|
||||
Assertions.assertEquals(funcList.get(0).getId(), request.getDragNodeId());
|
||||
Assertions.assertEquals(funcList.get(1).getId(), request.getDropNodeId());
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(request.getDragNodeId(), OperationLogType.UPDATE, URL_POST_RESOURCE_API_SCENARIO_SORT)
|
||||
);
|
||||
|
||||
//将这时的第80个放到第一位之后
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(funcList.get(0).getId());
|
||||
request.setDropPosition(1);
|
||||
result = this.requestPostWithOkAndReturn(URL_POST_RESOURCE_API_SCENARIO_SORT, request);
|
||||
resultHolder = JSON.parseObject(result.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class);
|
||||
response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanResourceSortResponse.class);
|
||||
Assertions.assertEquals(response.getSortNodeNum(), 1);
|
||||
funcList = testPlanTestService.selectTestPlanApiScenarioByTestPlanId(repeatCaseTestPlan.getId());
|
||||
Assertions.assertEquals(funcList.get(0).getId(), request.getDropNodeId());
|
||||
Assertions.assertEquals(funcList.get(1).getId(), request.getDragNodeId());
|
||||
LOG_CHECK_LIST.add(
|
||||
new CheckLogModel(request.getDragNodeId(), OperationLogType.UPDATE, URL_POST_RESOURCE_API_SCENARIO_SORT)
|
||||
);
|
||||
|
||||
//反例:测试计划为空
|
||||
request.setTestPlanId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_SORT, request).andExpect(status().isBadRequest());
|
||||
//反例: 测试计划不存在
|
||||
request.setTestPlanId(IDGenerator.nextStr());
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例:拖拽的节点不存在
|
||||
request.setTestPlanId(repeatCaseTestPlan.getId());
|
||||
request.setDragNodeId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例:目标节点不存在
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(null);
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例: 节点重复
|
||||
request.setDropNodeId(request.getDragNodeId());
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_SORT, request).andExpect(status().is5xxServerError());
|
||||
//反例: dropPosition取值范围不对
|
||||
request.setDragNodeId(funcList.get(79).getId());
|
||||
request.setDropNodeId(funcList.get(0).getId());
|
||||
request.setDropPosition(0);
|
||||
this.requestPost(URL_POST_RESOURCE_API_SCENARIO_SORT, request).andExpect(status().is5xxServerError());
|
||||
|
||||
//测试权限
|
||||
request.setDropPosition(1);
|
||||
this.requestPostPermissionTest(PermissionConstants.TEST_PLAN_READ_UPDATE, URL_POST_RESOURCE_API_SCENARIO_SORT, request);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Order(91)
|
||||
public void moveTest() throws Exception {
|
||||
this.preliminaryData();
|
||||
this.preliminaryTree();
|
||||
/*
|
||||
*默认节点
|
||||
|
|
||||
@ -1298,7 +1600,7 @@ public class TestPlanTests extends BaseTest {
|
||||
@Test
|
||||
@Order(102)
|
||||
public void deleteModuleTest() throws Exception {
|
||||
this.preliminaryData();
|
||||
this.preliminaryTree();
|
||||
|
||||
// 删除没有文件的节点a1-b1-c1 检查是否级联删除根节点
|
||||
BaseTreeNode a1b1Node = TestPlanTestUtils.getNodeByName(this.getFileModuleTreeNode(), "a1-b1");
|
||||
@ -1368,7 +1670,7 @@ public class TestPlanTests extends BaseTest {
|
||||
}
|
||||
|
||||
|
||||
private void preliminaryData() throws Exception {
|
||||
private void preliminaryTree() throws Exception {
|
||||
if (CollectionUtils.isEmpty(preliminaryTreeNodes)) {
|
||||
/*
|
||||
这里需要获取修改过的树的结构。期望的最终结构是这样的(*为测试用例中挂载文件的节点, · 为空节点):
|
||||
@ -1390,6 +1692,11 @@ public class TestPlanTests extends BaseTest {
|
||||
·a3
|
||||
*/
|
||||
this.updateModuleTest();
|
||||
}
|
||||
}
|
||||
|
||||
private void preliminaryTestPlan() throws Exception {
|
||||
if (ObjectUtils.anyNull(groupTestPlanId7, groupTestPlanId15)) {
|
||||
this.testPlanAddTest();
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,16 @@
|
||||
package io.metersphere.plan.service;
|
||||
|
||||
import io.metersphere.api.domain.ApiDefinition;
|
||||
import io.metersphere.api.domain.ApiScenario;
|
||||
import io.metersphere.api.domain.ApiTestCase;
|
||||
import io.metersphere.api.mapper.ApiDefinitionMapper;
|
||||
import io.metersphere.api.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.api.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.functional.domain.FunctionalCase;
|
||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||
import io.metersphere.plan.domain.*;
|
||||
import io.metersphere.plan.dto.request.TestPlanUpdateRequest;
|
||||
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
||||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.plan.mapper.*;
|
||||
import io.metersphere.sdk.constants.*;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
@ -30,6 +34,16 @@ public class TestPlanTestService {
|
||||
private FunctionalCaseMapper functionalCaseMapper;
|
||||
@Resource
|
||||
private TestPlanFunctionalCaseMapper testPlanFunctionalCaseMapper;
|
||||
@Resource
|
||||
private TestPlanApiCaseMapper testPlanApiCaseMapper;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
private ApiDefinitionMapper apiDefinitionMapper;
|
||||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
|
||||
public TestPlan selectTestPlanByName(String name) {
|
||||
TestPlanExample testPlanExample = new TestPlanExample();
|
||||
@ -136,11 +150,47 @@ public class TestPlanTestService {
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public List<ApiScenario> createApiScenario(int caseNums, String projectId) {
|
||||
List<ApiScenario> returnList = new ArrayList<>();
|
||||
for (int i = 0; i < caseNums; i++) {
|
||||
ApiScenario apiScenario = new ApiScenario();
|
||||
apiScenario.setId(IDGenerator.nextStr());
|
||||
apiScenario.setProjectId(projectId);
|
||||
apiScenario.setNum(NumGenerator.nextNum(projectId, ApplicationNumScope.API_SCENARIO));
|
||||
apiScenario.setModuleId(ModuleConstants.DEFAULT_NODE_ID);
|
||||
apiScenario.setName("api_scenario_" + projectId + "_" + i);
|
||||
apiScenario.setPriority("P0");
|
||||
apiScenario.setVersionId("v6.6.6");
|
||||
apiScenario.setPos((long) (i * 64));
|
||||
apiScenario.setRefId(apiScenario.getId());
|
||||
apiScenario.setStatus("Prepared");
|
||||
apiScenario.setLatest(true);
|
||||
apiScenario.setCreateUser("admin");
|
||||
apiScenario.setCreateTime(System.currentTimeMillis());
|
||||
apiScenario.setUpdateTime(System.currentTimeMillis());
|
||||
apiScenario.setUpdateUser("admin");
|
||||
apiScenario.setDeleted(false);
|
||||
apiScenario.setStepTotal(1);
|
||||
apiScenario.setRequestPassRate("100");
|
||||
returnList.add(apiScenario);
|
||||
}
|
||||
apiScenarioMapper.batchInsert(returnList);
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public long countResource(String id, String resourceFunctionalCase) {
|
||||
if (StringUtils.equals(TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, resourceFunctionalCase)) {
|
||||
TestPlanFunctionalCaseExample example = new TestPlanFunctionalCaseExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(id);
|
||||
return testPlanFunctionalCaseMapper.countByExample(example);
|
||||
} else if (StringUtils.equals(TestPlanResourceConstants.RESOURCE_API_CASE, resourceFunctionalCase)) {
|
||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(id);
|
||||
return testPlanApiCaseMapper.countByExample(example);
|
||||
} else if (StringUtils.equals(TestPlanResourceConstants.RESOURCE_API_SCENARIO, resourceFunctionalCase)) {
|
||||
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(id);
|
||||
return testPlanApiScenarioMapper.countByExample(example);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -152,6 +202,20 @@ public class TestPlanTestService {
|
||||
return testPlanFunctionalCaseMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<TestPlanApiCase> selectTestPlanApiCaseByTestPlanId(String testPlanId) {
|
||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(testPlanId);
|
||||
example.setOrderByClause(" pos asc ");
|
||||
return testPlanApiCaseMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<TestPlanApiScenario> selectTestPlanApiScenarioByTestPlanId(String testPlanId) {
|
||||
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(testPlanId);
|
||||
example.setOrderByClause(" pos asc ");
|
||||
return testPlanApiScenarioMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public TestPlanConfig selectTestPlanConfigById(String id) {
|
||||
return testPlanConfigMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
@ -227,4 +291,49 @@ public class TestPlanTestService {
|
||||
updateRequest.setId(testPlanId);
|
||||
return updateRequest;
|
||||
}
|
||||
|
||||
public List<ApiTestCase> createApiCases(int caseNums, String projectId) {
|
||||
ApiDefinition apiDefinition = new ApiDefinition();
|
||||
apiDefinition.setId(IDGenerator.nextStr());
|
||||
apiDefinition.setName("建国测试用接口");
|
||||
apiDefinition.setNum(NumGenerator.nextNum(projectId, ApplicationNumScope.API_DEFINITION));
|
||||
apiDefinition.setProtocol("HTTP");
|
||||
apiDefinition.setMethod("POST");
|
||||
apiDefinition.setPath("/api/def");
|
||||
apiDefinition.setStatus("Prepared");
|
||||
apiDefinition.setProjectId(projectId);
|
||||
apiDefinition.setModuleId(ModuleConstants.DEFAULT_NODE_ID);
|
||||
apiDefinition.setPos(0L);
|
||||
apiDefinition.setLatest(true);
|
||||
apiDefinition.setCreateUser("admin");
|
||||
apiDefinition.setCreateTime(System.currentTimeMillis());
|
||||
apiDefinition.setUpdateUser("admin");
|
||||
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
||||
apiDefinition.setRefId(apiDefinition.getId());
|
||||
apiDefinition.setVersionId("v6.6.6");
|
||||
apiDefinition.setDeleted(false);
|
||||
apiDefinitionMapper.insert(apiDefinition);
|
||||
|
||||
List<ApiTestCase> returnList = new ArrayList<>();
|
||||
for (int i = 0; i < caseNums; i++) {
|
||||
ApiTestCase apiTestCase = new ApiTestCase();
|
||||
apiTestCase.setId(IDGenerator.nextStr());
|
||||
apiTestCase.setApiDefinitionId(apiDefinition.getId());
|
||||
apiTestCase.setProjectId(projectId);
|
||||
apiTestCase.setNum(NumGenerator.nextNum(projectId + "_" + apiDefinition.getNum(), ApplicationNumScope.API_TEST_CASE));
|
||||
apiTestCase.setName(apiDefinition.getName() + "_test-case_" + i);
|
||||
apiTestCase.setPriority("P0");
|
||||
apiTestCase.setPos((long) (i * 64));
|
||||
apiTestCase.setStatus("Prepared");
|
||||
apiTestCase.setVersionId("v6.6.6");
|
||||
apiTestCase.setDeleted(false);
|
||||
apiTestCase.setCreateTime(System.currentTimeMillis());
|
||||
apiTestCase.setCreateUser("admin");
|
||||
apiTestCase.setUpdateUser("admin");
|
||||
apiTestCase.setUpdateTime(System.currentTimeMillis());
|
||||
returnList.add(apiTestCase);
|
||||
}
|
||||
apiTestCaseMapper.batchInsert(returnList);
|
||||
return returnList;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user