refactor(接口测试): 优化查询tags

This commit is contained in:
wxg0103 2024-01-09 18:13:42 +08:00 committed by Craftsman
parent fc038ce5a1
commit 47e85281db
28 changed files with 565 additions and 202 deletions

View File

@ -1,12 +1,17 @@
package io.metersphere.api.domain; package io.metersphere.api.domain;
import io.metersphere.validation.groups.*; import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import lombok.Data; import java.util.List;
@Data @Data
public class ApiDefinition implements Serializable { public class ApiDefinition implements Serializable {
@ -40,7 +45,7 @@ public class ApiDefinition implements Serializable {
private Long num; private Long num;
@Schema(description = "标签") @Schema(description = "标签")
private String tags; private List<String> tags;
@Schema(description = "自定义排序", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "自定义排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_definition.pos.not_blank}", groups = {Created.class}) @NotNull(message = "{api_definition.pos.not_blank}", groups = {Created.class})
@ -164,7 +169,7 @@ public class ApiDefinition implements Serializable {
return this.getEscapedColumnName() + " ASC"; return this.getEscapedColumnName() + " ASC";
} }
public static Column[] excludes(Column ... excludes) { public static Column[] excludes(Column... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values())); ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) { if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
@ -188,4 +193,4 @@ public class ApiDefinition implements Serializable {
return this.getEscapedColumnName(); return this.getEscapedColumnName();
} }
} }
} }

View File

@ -64,19 +64,50 @@ public class ApiDefinitionExample {
} }
protected abstract static class GeneratedCriteria { protected abstract static class GeneratedCriteria {
protected List<Criterion> tagsCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria; protected List<Criterion> criteria;
protected GeneratedCriteria() { protected GeneratedCriteria() {
super(); super();
criteria = new ArrayList<Criterion>(); criteria = new ArrayList<Criterion>();
tagsCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getTagsCriteria() {
return tagsCriteria;
}
protected void addTagsCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
} }
public boolean isValid() { public boolean isValid() {
return criteria.size() > 0; return criteria.size() > 0
|| tagsCriteria.size() > 0;
} }
public List<Criterion> getAllCriteria() { public List<Criterion> getAllCriteria() {
return criteria; if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(tagsCriteria);
}
return allCriteria;
} }
public List<Criterion> getCriteria() { public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class ApiDefinitionExample {
throw new RuntimeException("Value for condition cannot be null"); throw new RuntimeException("Value for condition cannot be null");
} }
criteria.add(new Criterion(condition)); criteria.add(new Criterion(condition));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value, String property) { protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class ApiDefinitionExample {
throw new RuntimeException("Value for " + property + " cannot be null"); throw new RuntimeException("Value for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value)); criteria.add(new Criterion(condition, value));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value1, Object value2, String property) { protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class ApiDefinitionExample {
throw new RuntimeException("Between values for " + property + " cannot be null"); throw new RuntimeException("Between values for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value1, value2)); criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
} }
public Criteria andIdIsNull() { public Criteria andIdIsNull() {
@ -594,63 +628,63 @@ public class ApiDefinitionExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsEqualTo(String value) { public Criteria andTagsEqualTo(List<String> value) {
addCriterion("tags =", value, "tags"); addTagsCriterion("tags =", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotEqualTo(String value) { public Criteria andTagsNotEqualTo(List<String> value) {
addCriterion("tags <>", value, "tags"); addTagsCriterion("tags <>", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsGreaterThan(String value) { public Criteria andTagsGreaterThan(List<String> value) {
addCriterion("tags >", value, "tags"); addTagsCriterion("tags >", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsGreaterThanOrEqualTo(String value) { public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
addCriterion("tags >=", value, "tags"); addTagsCriterion("tags >=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLessThan(String value) { public Criteria andTagsLessThan(List<String> value) {
addCriterion("tags <", value, "tags"); addTagsCriterion("tags <", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLessThanOrEqualTo(String value) { public Criteria andTagsLessThanOrEqualTo(List<String> value) {
addCriterion("tags <=", value, "tags"); addTagsCriterion("tags <=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLike(String value) { public Criteria andTagsLike(List<String> value) {
addCriterion("tags like", value, "tags"); addTagsCriterion("tags like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotLike(String value) { public Criteria andTagsNotLike(List<String> value) {
addCriterion("tags not like", value, "tags"); addTagsCriterion("tags not like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsIn(List<String> values) { public Criteria andTagsIn(List<List<String>> values) {
addCriterion("tags in", values, "tags"); addTagsCriterion("tags in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotIn(List<String> values) { public Criteria andTagsNotIn(List<List<String>> values) {
addCriterion("tags not in", values, "tags"); addTagsCriterion("tags not in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsBetween(String value1, String value2) { public Criteria andTagsBetween(List<String> value1, List<String> value2) {
addCriterion("tags between", value1, value2, "tags"); addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotBetween(String value1, String value2) { public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
addCriterion("tags not between", value1, value2, "tags"); addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -1,12 +1,16 @@
package io.metersphere.api.domain; package io.metersphere.api.domain;
import io.metersphere.validation.groups.*; import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import lombok.Data; import java.util.List;
@Data @Data
public class ApiDefinitionMock implements Serializable { public class ApiDefinitionMock implements Serializable {
@ -30,7 +34,7 @@ public class ApiDefinitionMock implements Serializable {
private String name; private String name;
@Schema(description = "自定义标签") @Schema(description = "自定义标签")
private String tags; private List<String> tags;
@Schema(description = "启用/禁用") @Schema(description = "启用/禁用")
private Boolean enable; private Boolean enable;
@ -107,7 +111,7 @@ public class ApiDefinitionMock implements Serializable {
return this.getEscapedColumnName() + " ASC"; return this.getEscapedColumnName() + " ASC";
} }
public static Column[] excludes(Column ... excludes) { public static Column[] excludes(Column... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values())); ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) { if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));

View File

@ -64,19 +64,50 @@ public class ApiDefinitionMockExample {
} }
protected abstract static class GeneratedCriteria { protected abstract static class GeneratedCriteria {
protected List<Criterion> tagsCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria; protected List<Criterion> criteria;
protected GeneratedCriteria() { protected GeneratedCriteria() {
super(); super();
criteria = new ArrayList<Criterion>(); criteria = new ArrayList<Criterion>();
tagsCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getTagsCriteria() {
return tagsCriteria;
}
protected void addTagsCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
} }
public boolean isValid() { public boolean isValid() {
return criteria.size() > 0; return criteria.size() > 0
|| tagsCriteria.size() > 0;
} }
public List<Criterion> getAllCriteria() { public List<Criterion> getAllCriteria() {
return criteria; if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(tagsCriteria);
}
return allCriteria;
} }
public List<Criterion> getCriteria() { public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class ApiDefinitionMockExample {
throw new RuntimeException("Value for condition cannot be null"); throw new RuntimeException("Value for condition cannot be null");
} }
criteria.add(new Criterion(condition)); criteria.add(new Criterion(condition));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value, String property) { protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class ApiDefinitionMockExample {
throw new RuntimeException("Value for " + property + " cannot be null"); throw new RuntimeException("Value for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value)); criteria.add(new Criterion(condition, value));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value1, Object value2, String property) { protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class ApiDefinitionMockExample {
throw new RuntimeException("Between values for " + property + " cannot be null"); throw new RuntimeException("Between values for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value1, value2)); criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
} }
public Criteria andIdIsNull() { public Criteria andIdIsNull() {
@ -444,63 +478,63 @@ public class ApiDefinitionMockExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsEqualTo(String value) { public Criteria andTagsEqualTo(List<String> value) {
addCriterion("tags =", value, "tags"); addTagsCriterion("tags =", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotEqualTo(String value) { public Criteria andTagsNotEqualTo(List<String> value) {
addCriterion("tags <>", value, "tags"); addTagsCriterion("tags <>", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsGreaterThan(String value) { public Criteria andTagsGreaterThan(List<String> value) {
addCriterion("tags >", value, "tags"); addTagsCriterion("tags >", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsGreaterThanOrEqualTo(String value) { public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
addCriterion("tags >=", value, "tags"); addTagsCriterion("tags >=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLessThan(String value) { public Criteria andTagsLessThan(List<String> value) {
addCriterion("tags <", value, "tags"); addTagsCriterion("tags <", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLessThanOrEqualTo(String value) { public Criteria andTagsLessThanOrEqualTo(List<String> value) {
addCriterion("tags <=", value, "tags"); addTagsCriterion("tags <=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLike(String value) { public Criteria andTagsLike(List<String> value) {
addCriterion("tags like", value, "tags"); addTagsCriterion("tags like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotLike(String value) { public Criteria andTagsNotLike(List<String> value) {
addCriterion("tags not like", value, "tags"); addTagsCriterion("tags not like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsIn(List<String> values) { public Criteria andTagsIn(List<List<String>> values) {
addCriterion("tags in", values, "tags"); addTagsCriterion("tags in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotIn(List<String> values) { public Criteria andTagsNotIn(List<List<String>> values) {
addCriterion("tags not in", values, "tags"); addTagsCriterion("tags not in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsBetween(String value1, String value2) { public Criteria andTagsBetween(List<String> value1, List<String> value2) {
addCriterion("tags between", value1, value2, "tags"); addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotBetween(String value1, String value2) { public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
addCriterion("tags not between", value1, value2, "tags"); addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -1,12 +1,17 @@
package io.metersphere.api.domain; package io.metersphere.api.domain;
import io.metersphere.validation.groups.*; import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import lombok.Data; import java.util.List;
@Data @Data
public class ApiTestCase implements Serializable { public class ApiTestCase implements Serializable {
@ -29,7 +34,7 @@ public class ApiTestCase implements Serializable {
private Long num; private Long num;
@Schema(description = "标签") @Schema(description = "标签")
private String tags; private List<String> tags;
@Schema(description = "用例状态", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "用例状态", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_test_case.status.not_blank}", groups = {Created.class}) @NotBlank(message = "{api_test_case.status.not_blank}", groups = {Created.class})
@ -153,7 +158,7 @@ public class ApiTestCase implements Serializable {
return this.getEscapedColumnName() + " ASC"; return this.getEscapedColumnName() + " ASC";
} }
public static Column[] excludes(Column ... excludes) { public static Column[] excludes(Column... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values())); ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) { if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));

View File

@ -64,19 +64,50 @@ public class ApiTestCaseExample {
} }
protected abstract static class GeneratedCriteria { protected abstract static class GeneratedCriteria {
protected List<Criterion> tagsCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria; protected List<Criterion> criteria;
protected GeneratedCriteria() { protected GeneratedCriteria() {
super(); super();
criteria = new ArrayList<Criterion>(); criteria = new ArrayList<Criterion>();
tagsCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getTagsCriteria() {
return tagsCriteria;
}
protected void addTagsCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
} }
public boolean isValid() { public boolean isValid() {
return criteria.size() > 0; return criteria.size() > 0
|| tagsCriteria.size() > 0;
} }
public List<Criterion> getAllCriteria() { public List<Criterion> getAllCriteria() {
return criteria; if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(tagsCriteria);
}
return allCriteria;
} }
public List<Criterion> getCriteria() { public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class ApiTestCaseExample {
throw new RuntimeException("Value for condition cannot be null"); throw new RuntimeException("Value for condition cannot be null");
} }
criteria.add(new Criterion(condition)); criteria.add(new Criterion(condition));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value, String property) { protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class ApiTestCaseExample {
throw new RuntimeException("Value for " + property + " cannot be null"); throw new RuntimeException("Value for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value)); criteria.add(new Criterion(condition, value));
allCriteria = null;
} }
protected void addCriterion(String condition, Object value1, Object value2, String property) { protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class ApiTestCaseExample {
throw new RuntimeException("Between values for " + property + " cannot be null"); throw new RuntimeException("Between values for " + property + " cannot be null");
} }
criteria.add(new Criterion(condition, value1, value2)); criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
} }
public Criteria andIdIsNull() { public Criteria andIdIsNull() {
@ -384,63 +418,63 @@ public class ApiTestCaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsEqualTo(String value) { public Criteria andTagsEqualTo(List<String> value) {
addCriterion("tags =", value, "tags"); addTagsCriterion("tags =", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotEqualTo(String value) { public Criteria andTagsNotEqualTo(List<String> value) {
addCriterion("tags <>", value, "tags"); addTagsCriterion("tags <>", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsGreaterThan(String value) { public Criteria andTagsGreaterThan(List<String> value) {
addCriterion("tags >", value, "tags"); addTagsCriterion("tags >", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsGreaterThanOrEqualTo(String value) { public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
addCriterion("tags >=", value, "tags"); addTagsCriterion("tags >=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLessThan(String value) { public Criteria andTagsLessThan(List<String> value) {
addCriterion("tags <", value, "tags"); addTagsCriterion("tags <", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLessThanOrEqualTo(String value) { public Criteria andTagsLessThanOrEqualTo(List<String> value) {
addCriterion("tags <=", value, "tags"); addTagsCriterion("tags <=", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsLike(String value) { public Criteria andTagsLike(List<String> value) {
addCriterion("tags like", value, "tags"); addTagsCriterion("tags like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotLike(String value) { public Criteria andTagsNotLike(List<String> value) {
addCriterion("tags not like", value, "tags"); addTagsCriterion("tags not like", value, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsIn(List<String> values) { public Criteria andTagsIn(List<List<String>> values) {
addCriterion("tags in", values, "tags"); addTagsCriterion("tags in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotIn(List<String> values) { public Criteria andTagsNotIn(List<List<String>> values) {
addCriterion("tags not in", values, "tags"); addTagsCriterion("tags not in", values, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsBetween(String value1, String value2) { public Criteria andTagsBetween(List<String> value1, List<String> value2) {
addCriterion("tags between", value1, value2, "tags"); addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTagsNotBetween(String value1, String value2) { public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
addCriterion("tags not between", value1, value2, "tags"); addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -9,7 +9,7 @@
<result column="path" jdbcType="VARCHAR" property="path" /> <result column="path" jdbcType="VARCHAR" property="path" />
<result column="status" jdbcType="VARCHAR" property="status" /> <result column="status" jdbcType="VARCHAR" property="status" />
<result column="num" jdbcType="BIGINT" property="num" /> <result column="num" jdbcType="BIGINT" property="num" />
<result column="tags" jdbcType="VARCHAR" property="tags" /> <result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="pos" jdbcType="BIGINT" property="pos" /> <result column="pos" jdbcType="BIGINT" property="pos" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" /> <result column="module_id" jdbcType="VARCHAR" property="moduleId" />
@ -49,6 +49,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -78,6 +97,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -121,20 +159,20 @@
<insert id="insert" parameterType="io.metersphere.api.domain.ApiDefinition"> <insert id="insert" parameterType="io.metersphere.api.domain.ApiDefinition">
insert into api_definition (id, `name`, protocol, insert into api_definition (id, `name`, protocol,
`method`, `path`, `status`, `method`, `path`, `status`,
num, tags, pos, project_id, num, tags,
module_id, latest, version_id, pos, project_id, module_id,
ref_id, description, create_time, latest, version_id, ref_id,
create_user, update_time, update_user, description, create_time, create_user,
delete_user, delete_time, deleted update_time, update_user, delete_user,
) delete_time, deleted)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{moduleId,jdbcType=VARCHAR}, #{latest,jdbcType=BIT}, #{versionId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
#{refId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{latest,jdbcType=BIT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{deleteUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleted,jdbcType=BIT} #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, #{deleteUser,jdbcType=VARCHAR},
) #{deleteTime,jdbcType=BIGINT}, #{deleted,jdbcType=BIT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiDefinition"> <insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiDefinition">
insert into api_definition insert into api_definition
@ -229,7 +267,7 @@
#{num,jdbcType=BIGINT}, #{num,jdbcType=BIGINT},
</if> </if>
<if test="tags != null"> <if test="tags != null">
#{tags,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="pos != null"> <if test="pos != null">
#{pos,jdbcType=BIGINT}, #{pos,jdbcType=BIGINT},
@ -306,7 +344,7 @@
num = #{record.num,jdbcType=BIGINT}, num = #{record.num,jdbcType=BIGINT},
</if> </if>
<if test="record.tags != null"> <if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="record.pos != null"> <if test="record.pos != null">
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
@ -364,7 +402,7 @@
`path` = #{record.path,jdbcType=VARCHAR}, `path` = #{record.path,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
num = #{record.num,jdbcType=BIGINT}, num = #{record.num,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR}, module_id = #{record.moduleId,jdbcType=VARCHAR},
@ -405,7 +443,7 @@
num = #{num,jdbcType=BIGINT}, num = #{num,jdbcType=BIGINT},
</if> </if>
<if test="tags != null"> <if test="tags != null">
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="pos != null"> <if test="pos != null">
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
@ -460,7 +498,7 @@
`path` = #{path,jdbcType=VARCHAR}, `path` = #{path,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
num = #{num,jdbcType=BIGINT}, num = #{num,jdbcType=BIGINT},
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR}, module_id = #{moduleId,jdbcType=VARCHAR},
@ -486,12 +524,12 @@
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.protocol,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.protocol,jdbcType=VARCHAR},
#{item.method,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, #{item.method,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
#{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.projectId,jdbcType=VARCHAR}, #{item.moduleId,jdbcType=VARCHAR}, #{item.latest,jdbcType=BIT}, #{item.pos,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}, #{item.moduleId,jdbcType=VARCHAR},
#{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR}, #{item.latest,jdbcType=BIT}, #{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR},
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.description,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
#{item.updateUser,jdbcType=VARCHAR}, #{item.deleteUser,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.deleteUser,jdbcType=VARCHAR},
#{item.deleted,jdbcType=BIT}) #{item.deleteTime,jdbcType=BIGINT}, #{item.deleted,jdbcType=BIT})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -526,7 +564,7 @@
#{item.num,jdbcType=BIGINT} #{item.num,jdbcType=BIGINT}
</if> </if>
<if test="'tags'.toString() == column.value"> <if test="'tags'.toString() == column.value">
#{item.tags,jdbcType=VARCHAR} #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if> </if>
<if test="'pos'.toString() == column.value"> <if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=BIGINT} #{item.pos,jdbcType=BIGINT}

View File

@ -7,7 +7,7 @@
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="tags" jdbcType="VARCHAR" property="tags" /> <result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="enable" jdbcType="BIT" property="enable" /> <result column="enable" jdbcType="BIT" property="enable" />
<result column="expect_num" jdbcType="VARCHAR" property="expectNum" /> <result column="expect_num" jdbcType="VARCHAR" property="expectNum" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
@ -37,6 +37,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -66,6 +85,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -111,7 +149,7 @@
`enable`, expect_num, project_id, `enable`, expect_num, project_id,
api_definition_id) api_definition_id)
values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{enable,jdbcType=BIT}, #{expectNum,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{expectNum,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{apiDefinitionId,jdbcType=VARCHAR}) #{apiDefinitionId,jdbcType=VARCHAR})
</insert> </insert>
@ -166,7 +204,7 @@
#{name,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
</if> </if>
<if test="tags != null"> <if test="tags != null">
#{tags,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="enable != null"> <if test="enable != null">
#{enable,jdbcType=BIT}, #{enable,jdbcType=BIT},
@ -207,7 +245,7 @@
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
</if> </if>
<if test="record.tags != null"> <if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="record.enable != null"> <if test="record.enable != null">
`enable` = #{record.enable,jdbcType=BIT}, `enable` = #{record.enable,jdbcType=BIT},
@ -233,7 +271,7 @@
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`enable` = #{record.enable,jdbcType=BIT}, `enable` = #{record.enable,jdbcType=BIT},
expect_num = #{record.expectNum,jdbcType=VARCHAR}, expect_num = #{record.expectNum,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
@ -258,7 +296,7 @@
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="tags != null"> <if test="tags != null">
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="enable != null"> <if test="enable != null">
`enable` = #{enable,jdbcType=BIT}, `enable` = #{enable,jdbcType=BIT},
@ -281,7 +319,7 @@
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`enable` = #{enable,jdbcType=BIT}, `enable` = #{enable,jdbcType=BIT},
expect_num = #{expectNum,jdbcType=VARCHAR}, expect_num = #{expectNum,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
@ -295,7 +333,7 @@
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, (#{item.id,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.enable,jdbcType=BIT}, #{item.expectNum,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.enable,jdbcType=BIT}, #{item.expectNum,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR},
#{item.apiDefinitionId,jdbcType=VARCHAR}) #{item.apiDefinitionId,jdbcType=VARCHAR})
</foreach> </foreach>
@ -326,7 +364,7 @@
#{item.name,jdbcType=VARCHAR} #{item.name,jdbcType=VARCHAR}
</if> </if>
<if test="'tags'.toString() == column.value"> <if test="'tags'.toString() == column.value">
#{item.tags,jdbcType=VARCHAR} #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if> </if>
<if test="'enable'.toString() == column.value"> <if test="'enable'.toString() == column.value">
#{item.enable,jdbcType=BIT} #{item.enable,jdbcType=BIT}

View File

@ -6,7 +6,7 @@
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="priority" jdbcType="VARCHAR" property="priority" /> <result column="priority" jdbcType="VARCHAR" property="priority" />
<result column="num" jdbcType="BIGINT" property="num" /> <result column="num" jdbcType="BIGINT" property="num" />
<result column="tags" jdbcType="VARCHAR" property="tags" /> <result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="status" jdbcType="VARCHAR" property="status" /> <result column="status" jdbcType="VARCHAR" property="status" />
<result column="last_report_status" jdbcType="VARCHAR" property="lastReportStatus" /> <result column="last_report_status" jdbcType="VARCHAR" property="lastReportStatus" />
<result column="last_report_id" jdbcType="VARCHAR" property="lastReportId" /> <result column="last_report_id" jdbcType="VARCHAR" property="lastReportId" />
@ -47,6 +47,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -76,6 +95,25 @@
</when> </when>
</choose> </choose>
</foreach> </foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim> </trim>
</if> </if>
</foreach> </foreach>
@ -118,19 +156,21 @@
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.api.domain.ApiTestCase"> <insert id="insert" parameterType="io.metersphere.api.domain.ApiTestCase">
insert into api_test_case (id, `name`, priority, insert into api_test_case (id, `name`, priority,
num, tags, `status`, last_report_status, num, tags,
last_report_id, pos, project_id, `status`, last_report_status, last_report_id,
api_definition_id, version_id, environment_id, pos, project_id, api_definition_id,
create_time, create_user, update_time, version_id, environment_id, create_time,
update_user, delete_time, delete_user, create_user, update_time, update_user,
deleted) delete_time, delete_user, deleted
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR},
#{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{lastReportStatus,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{lastReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{lastReportStatus,jdbcType=VARCHAR}, #{lastReportId,jdbcType=VARCHAR},
#{apiDefinitionId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{versionId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR},
#{deleted,jdbcType=BIT}) #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiTestCase"> <insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiTestCase">
insert into api_test_case insert into api_test_case
@ -210,7 +250,7 @@
#{num,jdbcType=BIGINT}, #{num,jdbcType=BIGINT},
</if> </if>
<if test="tags != null"> <if test="tags != null">
#{tags,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
@ -281,7 +321,7 @@
num = #{record.num,jdbcType=BIGINT}, num = #{record.num,jdbcType=BIGINT},
</if> </if>
<if test="record.tags != null"> <if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="record.status != null"> <if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
@ -339,7 +379,7 @@
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
priority = #{record.priority,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR},
num = #{record.num,jdbcType=BIGINT}, num = #{record.num,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
last_report_status = #{record.lastReportStatus,jdbcType=VARCHAR}, last_report_status = #{record.lastReportStatus,jdbcType=VARCHAR},
last_report_id = #{record.lastReportId,jdbcType=VARCHAR}, last_report_id = #{record.lastReportId,jdbcType=VARCHAR},
@ -372,7 +412,7 @@
num = #{num,jdbcType=BIGINT}, num = #{num,jdbcType=BIGINT},
</if> </if>
<if test="tags != null"> <if test="tags != null">
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if> </if>
<if test="status != null"> <if test="status != null">
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
@ -427,7 +467,7 @@
set `name` = #{name,jdbcType=VARCHAR}, set `name` = #{name,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR}, priority = #{priority,jdbcType=VARCHAR},
num = #{num,jdbcType=BIGINT}, num = #{num,jdbcType=BIGINT},
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
last_report_status = #{lastReportStatus,jdbcType=VARCHAR}, last_report_status = #{lastReportStatus,jdbcType=VARCHAR},
last_report_id = #{lastReportId,jdbcType=VARCHAR}, last_report_id = #{lastReportId,jdbcType=VARCHAR},
@ -453,8 +493,8 @@
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.priority,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.priority,jdbcType=VARCHAR},
#{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.lastReportStatus,jdbcType=VARCHAR}, #{item.lastReportId,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, #{item.lastReportStatus,jdbcType=VARCHAR}, #{item.lastReportId,jdbcType=VARCHAR},
#{item.pos,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}, #{item.apiDefinitionId,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}, #{item.apiDefinitionId,jdbcType=VARCHAR},
#{item.versionId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.versionId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR},
@ -485,7 +525,7 @@
#{item.num,jdbcType=BIGINT} #{item.num,jdbcType=BIGINT}
</if> </if>
<if test="'tags'.toString() == column.value"> <if test="'tags'.toString() == column.value">
#{item.tags,jdbcType=VARCHAR} #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if> </if>
<if test="'status'.toString() == column.value"> <if test="'status'.toString() == column.value">
#{item.status,jdbcType=VARCHAR} #{item.status,jdbcType=VARCHAR}

View File

@ -8,6 +8,8 @@ import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class TestCaseProviderDTO { public class TestCaseProviderDTO {
@ -30,7 +32,7 @@ public class TestCaseProviderDTO {
private Long num; private Long num;
@Schema(description = "标签") @Schema(description = "标签")
private String tags; private List<String> tags;
@Schema(description = "自定义排序", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "自定义排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_test_case.pos.not_blank}", groups = {Created.class}) @NotNull(message = "{api_test_case.pos.not_blank}", groups = {Created.class})

View File

@ -6,7 +6,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -30,4 +32,12 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements
@Schema(description = "用例等级") @Schema(description = "用例等级")
private String priority; private String priority;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
} }

View File

@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -23,11 +24,11 @@ public class ApiDefinitionAddRequest implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Schema(description = "接口名称", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "接口名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(min = 1, max = 255, message = "{api_definition.name.length_range}") @Size(min = 1, max = 255, message = "{api_definition.name.length_range}")
private String name; private String name;
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition.protocol.not_blank}") @NotBlank(message = "{api_definition.protocol.not_blank}")
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}") @Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
@ -89,4 +90,12 @@ public class ApiDefinitionAddRequest implements Serializable {
public void setPath(String path) { public void setPath(String path) {
this.path = StringUtils.trim(path); this.path = StringUtils.trim(path);
} }
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
} }

View File

@ -7,7 +7,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serial; import java.io.Serial;
import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
/** /**
* @author lan * @author lan
@ -42,4 +44,12 @@ public class ApiDefinitionBatchUpdateRequest extends ApiDefinitionBatchRequest {
@Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED)
private boolean append = false; private boolean append = false;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
} }

View File

@ -6,6 +6,7 @@ import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -63,4 +64,12 @@ public class ApiTestCaseAddRequest implements Serializable {
@Schema(description = "关联文件ID") @Schema(description = "关联文件ID")
private List<String> linkFileIds; private List<String> linkFileIds;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
} }

View File

@ -4,7 +4,6 @@ import io.metersphere.plugin.api.spi.AbstractMsTestElement;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
@ -79,7 +78,7 @@ public class ApiTestCaseDTO {
private String deleteName; private String deleteName;
@Schema(description = "标签") @Schema(description = "标签")
private List<String> tags = new ArrayList<>(); private List<String> tags;
@Schema(description = "用例通过率") @Schema(description = "用例通过率")
private String passRate; private String passRate;

View File

@ -6,6 +6,7 @@ import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
@ -70,4 +71,12 @@ public class ApiTestCaseUpdateRequest implements Serializable {
@Schema(description = "取消关联文件ID") @Schema(description = "取消关联文件ID")
private List<String> unLinkRefIds; private List<String> unLinkRefIds;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
} }

View File

@ -0,0 +1,40 @@
package io.metersphere.api.dto.definition.importdto;
import io.metersphere.api.dto.request.http.Header;
import io.metersphere.api.dto.request.http.QueryParam;
import io.metersphere.api.dto.request.http.auth.HTTPAuth;
import io.metersphere.system.domain.Schedule;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class ScheduleRequest extends Schedule {
//定时任务来源 测试计划/测试场景
private String scheduleFrom;
private String projectId;
private String moduleId;
private String modulePath;
private String modeId;
private String swaggerUrl;
private String taskId;
// 鉴权相关
@Schema(description = "swagger的请求头参数")
private List<Header> headers;
@Schema(description = "swagger的请求参数")
private List<QueryParam> arguments;
@Schema(description = "swagger的认证参数")
private HTTPAuth authManager;
private Boolean coverModule = false;
}

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -24,7 +25,7 @@ public class ApiDefinitionMockAddRequest implements Serializable {
@Size(min = 1, max = 50, message = "{api_definition_mock.project_id.length_range}") @Size(min = 1, max = 50, message = "{api_definition_mock.project_id.length_range}")
private String projectId; private String projectId;
@Schema(description = "接口 mock 名称", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "接口 mock 名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition_mock.name.not_blank}") @NotBlank(message = "{api_definition_mock.name.not_blank}")
@Size(min = 1, max = 255, message = "{api_definition_mock.name.length_range}") @Size(min = 1, max = 255, message = "{api_definition_mock.name.length_range}")
private String name; private String name;
@ -58,4 +59,12 @@ public class ApiDefinitionMockAddRequest implements Serializable {
@Schema(description = "关联文件ID") @Schema(description = "关联文件ID")
private List<String> linkFileIds; private List<String> linkFileIds;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
} }

View File

@ -2,7 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.api.mapper.ExtApiDefinitionMapper"> <mapper namespace="io.metersphere.api.mapper.ExtApiDefinitionMapper">
<resultMap id="ApiDefinitionDTO" type="io.metersphere.api.dto.definition.ApiDefinitionDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<resultMap id="BaseResultMap" type="io.metersphere.api.domain.ApiDefinition">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<update id="deleteApiToGc"> <update id="deleteApiToGc">
update api_definition update api_definition
set delete_user = #{userId},delete_time = #{time}, deleted = 1 , module_id = 'root' set delete_user = #{userId},delete_time = #{time}, deleted = 1 , module_id = 'root'
@ -11,7 +17,7 @@
#{v} #{v}
</foreach> </foreach>
</update> </update>
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionDTO"> <select id="list" resultMap="ApiDefinitionDTO">
select select
api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`, api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`,
api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos, api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos,
@ -26,7 +32,7 @@
</select> </select>
<select id="listDoc" resultType="io.metersphere.api.dto.definition.ApiDefinitionDTO"> <select id="listDoc" resultMap="ApiDefinitionDTO">
select select
api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`, api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`,
api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos, api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos,
@ -121,7 +127,7 @@
WHERE ref_id = #{refId} WHERE ref_id = #{refId}
</select> </select>
<select id="getTagsByIds" resultType="io.metersphere.api.domain.ApiDefinition"> <select id="getTagsByIds" resultMap="BaseResultMap">
select id, tags from api_definition select id, tags from api_definition
where id in where id in
<foreach collection="ids" item="id" open="(" separator="," close=")"> <foreach collection="ids" item="id" open="(" separator="," close=")">

View File

@ -2,7 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.api.mapper.ExtApiDefinitionMockMapper"> <mapper namespace="io.metersphere.api.mapper.ExtApiDefinitionMockMapper">
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionMockDTO"> <resultMap id="ApiDefinitionMockDTO" type="io.metersphere.api.dto.definition.ApiDefinitionMockDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<select id="list" resultMap="ApiDefinitionMockDTO">
select select
m.id, m.create_time, m.update_time, m.create_user, m.`name`, m.tags, m.`enable`, m.expect_num, m.project_id, m.id, m.create_time, m.update_time, m.create_user, m.`name`, m.tags, m.`enable`, m.expect_num, m.project_id,
m.api_definition_id, u.name as create_user_name m.api_definition_id, u.name as create_user_name

View File

@ -2,6 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.api.mapper.ExtApiTestCaseMapper"> <mapper namespace="io.metersphere.api.mapper.ExtApiTestCaseMapper">
<resultMap id="ApiTestCaseDTO" type="io.metersphere.api.dto.definition.ApiTestCaseDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<resultMap id="TestCaseProviderDTO" type="io.metersphere.dto.TestCaseProviderDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<update id="batchMoveGc"> <update id="batchMoveGc">
UPDATE api_test_case UPDATE api_test_case
SET deleted = 1, SET deleted = 1,
@ -21,7 +28,7 @@
LIMIT 1; LIMIT 1;
</select> </select>
<select id="listByRequest" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO"> <select id="listByRequest" resultMap="ApiTestCaseDTO">
SELECT SELECT
t1.id, t1.id,
t1.project_id, t1.project_id,
@ -39,6 +46,7 @@
t1.last_report_status, t1.last_report_status,
t1.last_report_id, t1.last_report_id,
t1.environment_id, t1.environment_id,
t1.tags,
a.module_id a.module_id
FROM FROM
api_test_case t1 api_test_case t1
@ -153,7 +161,7 @@
</foreach> </foreach>
</select> </select>
<select id="listByProviderRequest" resultType="io.metersphere.dto.TestCaseProviderDTO"> <select id="listByProviderRequest" resultMap="TestCaseProviderDTO">
SELECT SELECT
t1.id, t1.id,
t1.project_id, t1.project_id,

View File

@ -23,7 +23,6 @@ import io.metersphere.sdk.constants.DefaultRepositoryDir;
import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.FileAssociationSourceUtil; import io.metersphere.sdk.util.FileAssociationSourceUtil;
import io.metersphere.sdk.util.JSON;
import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import io.metersphere.system.uid.NumGenerator; import io.metersphere.system.uid.NumGenerator;
@ -79,7 +78,7 @@ public class ApiDefinitionMockService {
apiDefinitionMockConfigOptional.ifPresent(config -> { apiDefinitionMockConfigOptional.ifPresent(config -> {
apiDefinitionMockDTO.setMatching(ApiDataUtils.parseObject(new String(config.getMatching()), AbstractMsTestElement.class)); apiDefinitionMockDTO.setMatching(ApiDataUtils.parseObject(new String(config.getMatching()), AbstractMsTestElement.class));
apiDefinitionMockDTO.setResponse(ApiDataUtils.parseArray(new String(config.getResponse()), HttpResponse.class)); apiDefinitionMockDTO.setResponse(ApiDataUtils.parseArray(new String(config.getResponse()), HttpResponse.class));
}); });
} }
public void handleApiDefinition(String id, ApiDefinitionMockDTO apiDefinitionMockDTO) { public void handleApiDefinition(String id, ApiDefinitionMockDTO apiDefinitionMockDTO) {
@ -97,7 +96,7 @@ public class ApiDefinitionMockService {
* @param id mock id * @param id mock id
*/ */
private ApiDefinitionMock checkApiDefinitionMock(String id) { private ApiDefinitionMock checkApiDefinitionMock(String id) {
return ServiceUtils.checkResourceExist(apiDefinitionMockMapper.selectByPrimaryKey(id),"permission.api_mock.name"); return ServiceUtils.checkResourceExist(apiDefinitionMockMapper.selectByPrimaryKey(id), "permission.api_mock.name");
} }
public ApiDefinitionMock create(ApiDefinitionMockAddRequest request, String userId) { public ApiDefinitionMock create(ApiDefinitionMockAddRequest request, String userId) {
@ -111,7 +110,7 @@ public class ApiDefinitionMockService {
apiDefinitionMock.setUpdateTime(System.currentTimeMillis()); apiDefinitionMock.setUpdateTime(System.currentTimeMillis());
apiDefinitionMock.setCreateUser(userId); apiDefinitionMock.setCreateUser(userId);
if (CollectionUtils.isNotEmpty(request.getTags())) { if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinitionMock.setTags(JSON.toJSONString(request.getTags())); apiDefinitionMock.setTags(request.getTags());
} }
apiDefinitionMock.setEnable(true); apiDefinitionMock.setEnable(true);
ApiDefinition apiDefinition = apiDefinitionMapper.selectByPrimaryKey(apiDefinitionMock.getApiDefinitionId()); ApiDefinition apiDefinition = apiDefinitionMapper.selectByPrimaryKey(apiDefinitionMock.getApiDefinitionId());
@ -172,7 +171,7 @@ public class ApiDefinitionMockService {
checkUpdateExist(apiDefinitionMock); checkUpdateExist(apiDefinitionMock);
apiDefinitionMock.setUpdateTime(System.currentTimeMillis()); apiDefinitionMock.setUpdateTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(request.getTags())) { if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinitionMock.setTags(JSON.toJSONString(request.getTags())); apiDefinitionMock.setTags(request.getTags());
} }
apiDefinitionMockMapper.updateByPrimaryKeySelective(apiDefinitionMock); apiDefinitionMockMapper.updateByPrimaryKeySelective(apiDefinitionMock);
ApiDefinitionMockConfig apiDefinitionMockConfig = new ApiDefinitionMockConfig(); ApiDefinitionMockConfig apiDefinitionMockConfig = new ApiDefinitionMockConfig();
@ -229,7 +228,7 @@ public class ApiDefinitionMockService {
} }
private String getCopyName(String name) { private String getCopyName(String name) {
String copyName = "copy_" + name ; String copyName = "copy_" + name;
if (copyName.length() > 200) { if (copyName.length() > 200) {
copyName = copyName.substring(0, 195) + copyName.substring(copyName.length() - 5); copyName = copyName.substring(0, 195) + copyName.substring(copyName.length() - 5);
} }
@ -255,7 +254,7 @@ public class ApiDefinitionMockService {
List<ApiDefinitionMock> apiDefinitionMocks = apiDefinitionMockMapper.selectByExample(apiDefinitionMockExample); List<ApiDefinitionMock> apiDefinitionMocks = apiDefinitionMockMapper.selectByExample(apiDefinitionMockExample);
if(!apiDefinitionMocks.isEmpty()){ if (!apiDefinitionMocks.isEmpty()) {
apiDefinitionMocks.forEach(item -> { apiDefinitionMocks.forEach(item -> {
String apiDefinitionMockDir = DefaultRepositoryDir.getApiDefinitionDir(item.getProjectId(), item.getId()); String apiDefinitionMockDir = DefaultRepositoryDir.getApiDefinitionDir(item.getProjectId(), item.getId());
apiFileResourceService.deleteByResourceId(apiDefinitionMockDir, item.getId(), item.getProjectId(), userId, OperationLogModule.API_DEFINITION_MOCK); apiFileResourceService.deleteByResourceId(apiDefinitionMockDir, item.getId(), item.getProjectId(), userId, OperationLogModule.API_DEFINITION_MOCK);

View File

@ -170,7 +170,7 @@ public class ApiDefinitionService {
apiDefinition.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId()))); apiDefinition.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId())));
apiDefinition.setRefId(apiDefinition.getId()); apiDefinition.setRefId(apiDefinition.getId());
if (CollectionUtils.isNotEmpty(request.getTags())) { if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinition.setTags(JSON.toJSONString(request.getTags())); apiDefinition.setTags(request.getTags());
} }
apiDefinitionMapper.insertSelective(apiDefinition); apiDefinitionMapper.insertSelective(apiDefinition);
ApiDefinitionBlob apiDefinitionBlob = new ApiDefinitionBlob(); ApiDefinitionBlob apiDefinitionBlob = new ApiDefinitionBlob();
@ -222,7 +222,7 @@ public class ApiDefinitionService {
apiDefinition.setUpdateTime(System.currentTimeMillis()); apiDefinition.setUpdateTime(System.currentTimeMillis());
apiDefinition.setVersionId(request.getVersionId()); apiDefinition.setVersionId(request.getVersionId());
if (CollectionUtils.isNotEmpty(request.getTags())) { if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinition.setTags(JSON.toJSONString(request.getTags())); apiDefinition.setTags(request.getTags());
} }
apiDefinitionMapper.updateByPrimaryKeySelective(apiDefinition); apiDefinitionMapper.updateByPrimaryKeySelective(apiDefinition);
ApiDefinitionBlob apiDefinitionBlob = new ApiDefinitionBlob(); ApiDefinitionBlob apiDefinitionBlob = new ApiDefinitionBlob();
@ -529,12 +529,12 @@ public class ApiDefinitionService {
ApiDefinitionMapper definitionMapper = sqlSession.getMapper(ApiDefinitionMapper.class); ApiDefinitionMapper definitionMapper = sqlSession.getMapper(ApiDefinitionMapper.class);
ids.forEach(id -> { ids.forEach(id -> {
ApiDefinition apiDefinition = new ApiDefinition(); ApiDefinition apiDefinition = new ApiDefinition();
if (StringUtils.isNotBlank(collect.get(id).getTags())) { if (CollectionUtils.isNotEmpty(collect.get(id).getTags())) {
LinkedHashSet<String> tags = new LinkedHashSet<>((JSON.parseArray(collect.get(id).getTags(), String.class))); List<String> tags = collect.get(id).getTags();
tags.addAll(request.getTags()); tags.addAll(request.getTags());
apiDefinition.setTags(JSON.toJSONString(tags)); apiDefinition.setTags(tags);
} else { } else {
apiDefinition.setTags(JSON.toJSONString(request.getTags())); apiDefinition.setTags(request.getTags());
} }
apiDefinition.setId(id); apiDefinition.setId(id);
apiDefinition.setUpdateTime(System.currentTimeMillis()); apiDefinition.setUpdateTime(System.currentTimeMillis());
@ -547,7 +547,7 @@ public class ApiDefinitionService {
} else { } else {
//替换标签 //替换标签
ApiDefinition apiDefinition = new ApiDefinition(); ApiDefinition apiDefinition = new ApiDefinition();
apiDefinition.setTags(JSON.toJSONString(request.getTags())); apiDefinition.setTags(request.getTags());
apiDefinition.setProjectId(request.getProjectId()); apiDefinition.setProjectId(request.getProjectId());
apiDefinition.setUpdateTime(System.currentTimeMillis()); apiDefinition.setUpdateTime(System.currentTimeMillis());
apiDefinition.setUpdateUser(userId); apiDefinition.setUpdateUser(userId);

View File

@ -9,11 +9,11 @@ import io.metersphere.api.dto.definition.ApiTestCaseLogDTO;
import io.metersphere.api.dto.definition.ApiTestCaseUpdateRequest; import io.metersphere.api.dto.definition.ApiTestCaseUpdateRequest;
import io.metersphere.api.mapper.ApiTestCaseBlobMapper; import io.metersphere.api.mapper.ApiTestCaseBlobMapper;
import io.metersphere.api.mapper.ApiTestCaseMapper; import io.metersphere.api.mapper.ApiTestCaseMapper;
import io.metersphere.api.utils.ApiDataUtils;
import io.metersphere.plugin.api.spi.AbstractMsTestElement; import io.metersphere.plugin.api.spi.AbstractMsTestElement;
import io.metersphere.project.domain.Project; import io.metersphere.project.domain.Project;
import io.metersphere.project.mapper.ProjectMapper; import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.sdk.constants.HttpMethodConstants; import io.metersphere.sdk.constants.HttpMethodConstants;
import io.metersphere.api.utils.ApiDataUtils;
import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.Translator; import io.metersphere.sdk.util.Translator;
@ -112,7 +112,7 @@ public class ApiTestCaseLogService {
OperationLogType.RECOVER.name(), OperationLogType.RECOVER.name(),
OperationLogModule.API_DEFINITION_CASE, OperationLogModule.API_DEFINITION_CASE,
apiTestCase.getName()); apiTestCase.getName());
dto.setHistory(true); dto.setHistory(false);
dto.setPath("/api/case/recover/" + id); dto.setPath("/api/case/recover/" + id);
dto.setMethod(HttpMethodConstants.GET.name()); dto.setMethod(HttpMethodConstants.GET.name());
dto.setOriginalValue(JSON.toJSONBytes(apiTestCase)); dto.setOriginalValue(JSON.toJSONBytes(apiTestCase));
@ -231,7 +231,7 @@ public class ApiTestCaseLogService {
} }
public void batchRecoverLog(List<ApiTestCase> apiTestCases, String operator, String projectId) { public void batchRecoverLog(List<ApiTestCase> apiTestCases, String operator, String projectId) {
saveBatchLog(projectId, apiTestCases, "/api/case/recover", operator, OperationLogType.RECOVER.name(), true); saveBatchLog(projectId, apiTestCases, "/api/case/recover", operator, OperationLogType.RECOVER.name(), false);
} }
private void saveBatchLog(String projectId, List<ApiTestCase> apiTestCases, String path, String operator, String operationType, boolean isHistory) { private void saveBatchLog(String projectId, List<ApiTestCase> apiTestCases, String path, String operator, String operationType, boolean isHistory) {
@ -267,7 +267,7 @@ public class ApiTestCaseLogService {
.createUser(operator) .createUser(operator)
.originalValue(JSON.toJSONBytes(apiTestCaseDTO)) .originalValue(JSON.toJSONBytes(apiTestCaseDTO))
.build().getLogDTO(); .build().getLogDTO();
dto.setHistory(isHistory); dto.setHistory(isHistory);
logs.add(dto); logs.add(dto);
} }
); );

View File

@ -16,7 +16,10 @@ import io.metersphere.sdk.domain.Environment;
import io.metersphere.sdk.domain.EnvironmentExample; import io.metersphere.sdk.domain.EnvironmentExample;
import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.mapper.EnvironmentMapper; import io.metersphere.sdk.mapper.EnvironmentMapper;
import io.metersphere.sdk.util.*; import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.FileAssociationSourceUtil;
import io.metersphere.sdk.util.SubListUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.dto.sdk.request.PosRequest; import io.metersphere.system.dto.sdk.request.PosRequest;
import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.service.UserLoginService; import io.metersphere.system.service.UserLoginService;
@ -36,7 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -143,7 +145,7 @@ public class ApiTestCaseService {
testCase.setCreateTime(System.currentTimeMillis()); testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis()); testCase.setUpdateTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(request.getTags())) { if (CollectionUtils.isNotEmpty(request.getTags())) {
testCase.setTags(JSON.toJSONString(request.getTags())); testCase.setTags(request.getTags());
} }
apiTestCaseMapper.insertSelective(testCase); apiTestCaseMapper.insertSelective(testCase);
@ -159,6 +161,7 @@ public class ApiTestCaseService {
apiFileResourceService.addFileResource(resourceUpdateRequest); apiFileResourceService.addFileResource(resourceUpdateRequest);
return testCase; return testCase;
} }
private ApiTestCase checkResourceExist(String id) { private ApiTestCase checkResourceExist(String id) {
ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(id); ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(id);
if (testCase == null) { if (testCase == null) {
@ -172,8 +175,8 @@ public class ApiTestCaseService {
ApiTestCase testCase = checkResourceExist(id); ApiTestCase testCase = checkResourceExist(id);
ApiTestCaseBlob testCaseBlob = apiTestCaseBlobMapper.selectByPrimaryKey(id); ApiTestCaseBlob testCaseBlob = apiTestCaseBlobMapper.selectByPrimaryKey(id);
BeanUtils.copyBean(apiTestCaseDTO, testCase); BeanUtils.copyBean(apiTestCaseDTO, testCase);
if (StringUtils.isNotBlank(testCase.getTags())) { if (CollectionUtils.isNotEmpty(testCase.getTags())) {
apiTestCaseDTO.setTags(JSON.parseArray(testCase.getTags(), String.class)); apiTestCaseDTO.setTags(testCase.getTags());
} else { } else {
apiTestCaseDTO.setTags(new ArrayList<>()); apiTestCaseDTO.setTags(new ArrayList<>());
} }
@ -225,7 +228,7 @@ public class ApiTestCaseService {
testCase.setUpdateUser(userId); testCase.setUpdateUser(userId);
testCase.setUpdateTime(System.currentTimeMillis()); testCase.setUpdateTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(request.getTags())) { if (CollectionUtils.isNotEmpty(request.getTags())) {
testCase.setTags(JSON.toJSONString(request.getTags())); testCase.setTags(request.getTags());
} else { } else {
testCase.setTags(null); testCase.setTags(null);
} }
@ -432,7 +435,7 @@ public class ApiTestCaseService {
} }
private void batchUpdateTags(ApiTestCaseExample example, ApiTestCase updateCase, private void batchUpdateTags(ApiTestCaseExample example, ApiTestCase updateCase,
LinkedHashSet<String> tags, boolean appendTag, List<String> tags, boolean appendTag,
SqlSession sqlSession, ApiTestCaseMapper mapper) { SqlSession sqlSession, ApiTestCaseMapper mapper) {
if (CollectionUtils.isEmpty(tags)) { if (CollectionUtils.isEmpty(tags)) {
throw new MSException(Translator.get("tags_is_null")); throw new MSException(Translator.get("tags_is_null"));
@ -441,12 +444,12 @@ public class ApiTestCaseService {
List<ApiTestCase> caseList = apiTestCaseMapper.selectByExample(example); List<ApiTestCase> caseList = apiTestCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(caseList)) { if (CollectionUtils.isNotEmpty(caseList)) {
caseList.forEach(apiTestCase -> { caseList.forEach(apiTestCase -> {
if (StringUtils.isNotBlank(apiTestCase.getTags())) { if (CollectionUtils.isNotEmpty(apiTestCase.getTags())) {
LinkedHashSet orgTags = ApiDataUtils.parseObject(apiTestCase.getTags(), LinkedHashSet.class); List<String> orgTags = apiTestCase.getTags();
orgTags.addAll(tags); orgTags.addAll(tags);
apiTestCase.setTags(JSON.toJSONString(orgTags)); apiTestCase.setTags(orgTags);
} else { } else {
apiTestCase.setTags(JSON.toJSONString(tags)); apiTestCase.setTags(tags);
} }
mapper.updateByPrimaryKey(apiTestCase); mapper.updateByPrimaryKey(apiTestCase);
}); });
@ -456,7 +459,7 @@ public class ApiTestCaseService {
} }
} }
} else { } else {
updateCase.setTags(JSON.toJSONString(tags)); updateCase.setTags(tags);
apiTestCaseMapper.updateByExampleSelective(updateCase, example); apiTestCaseMapper.updateByExampleSelective(updateCase, example);
} }
} }

View File

@ -73,7 +73,6 @@
<table tableName="api_debug"/> <table tableName="api_debug"/>
<table tableName="api_debug_blob"/> <table tableName="api_debug_blob"/>
<table tableName="api_debug_module"/> <table tableName="api_debug_module"/>
<table tableName="api_definition"/>
<table tableName="api_definition_blob"/> <table tableName="api_definition_blob"/>
<table tableName="api_definition_follower"/> <table tableName="api_definition_follower"/>
<table tableName="api_definition_mock"/> <table tableName="api_definition_mock"/>
@ -94,13 +93,19 @@
<table tableName="api_scenario_report_log"/> <table tableName="api_scenario_report_log"/>
<table tableName="api_scenario_report_structure"/> <table tableName="api_scenario_report_structure"/>
<table tableName="api_sync_config"/> <table tableName="api_sync_config"/>
<table tableName="api_test_case"/>
<table tableName="api_test_case_blob"/> <table tableName="api_test_case_blob"/>
<table tableName="api_test_case_follower"/> <table tableName="api_test_case_follower"/>
<table tableName="api_definition_mock"/>
<table tableName="api_definition_mock_config"/> <table tableName="api_definition_mock_config"/>
<table tableName="api_definition_custom_field"/> <table tableName="api_definition_custom_field"/>
<table tableName="api_definition_mock">
<columnOverride column="tags" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR" typeHandler="io.metersphere.handler.ListTypeHandler" />
</table>
<table tableName="api_definition">
<columnOverride column="tags" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR" typeHandler="io.metersphere.handler.ListTypeHandler" />
</table>
<table tableName="api_test_case">
<columnOverride column="tags" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR" typeHandler="io.metersphere.handler.ListTypeHandler" />
</table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>

View File

@ -528,9 +528,9 @@ public class ApiDefinitionControllerTests extends BaseTest {
} }
if (request.getTags() != null) { if (request.getTags() != null) {
if (request.isAppend()) { if (request.isAppend()) {
Assertions.assertTrue(JSON.parseArray(item.getTags(), String.class).containsAll(request.getTags())); Assertions.assertTrue(item.getTags().containsAll(request.getTags()));
} else { } else {
Assertions.assertEquals(item.getTags(), JSON.toJSONString(request.getTags())); Assertions.assertTrue(item.getTags().containsAll(request.getTags()));
} }
} }
}); });

View File

@ -372,8 +372,8 @@ public class ApiTestCaseControllerTests extends BaseTest {
// 校验数据是否正确 // 校验数据是否正确
ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()); ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId());
ApiTestCaseDTO copyApiDebugDTO = BeanUtils.copyBean(new ApiTestCaseDTO(), testCase); ApiTestCaseDTO copyApiDebugDTO = BeanUtils.copyBean(new ApiTestCaseDTO(), testCase);
if (StringUtils.isNotEmpty(testCase.getTags())) { if (CollectionUtils.isNotEmpty(testCase.getTags())) {
copyApiDebugDTO.setTags(JSON.parseArray(testCase.getTags(), String.class)); copyApiDebugDTO.setTags(testCase.getTags());
} else { } else {
copyApiDebugDTO.setTags(new ArrayList<>()); copyApiDebugDTO.setTags(new ArrayList<>());
} }
@ -679,7 +679,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
request.setAppendTag(false); request.setAppendTag(false);
responsePost(BATCH_EDIT, request); responsePost(BATCH_EDIT, request);
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> { apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
Assertions.assertEquals(apiTestCase.getTags(), "[\"tag1\"]"); Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
}); });
//标签为空 报错 //标签为空 报错
request.setTags(new LinkedHashSet<>()); request.setTags(new LinkedHashSet<>());
@ -858,6 +858,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
request.setSelectAll(true); request.setSelectAll(true);
request.setSelectIds(List.of(apiTestCase.getId())); request.setSelectIds(List.of(apiTestCase.getId()));
request.setExcludeIds(List.of(apiTestCase.getId())); request.setExcludeIds(List.of(apiTestCase.getId()));
request.setApiDefinitionId("apiDefinitionId");
request.setModuleIds(List.of("case-moduleId")); request.setModuleIds(List.of("case-moduleId"));
responsePost(BATCH_RECOVER, request); responsePost(BATCH_RECOVER, request);
ApiTestCaseExample example = new ApiTestCaseExample(); ApiTestCaseExample example = new ApiTestCaseExample();
@ -873,7 +874,16 @@ public class ApiTestCaseControllerTests extends BaseTest {
checkLog(apiTestCase.getId(), OperationLogType.DELETE); checkLog(apiTestCase.getId(), OperationLogType.DELETE);
//校验权限 //校验权限
requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER, BATCH_RECOVER, request); requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER, BATCH_RECOVER, request);
this.batchMoveGc(); ApiTestCaseBatchRequest gcRequest = new ApiTestCaseBatchRequest();
gcRequest.setProjectId(DEFAULT_PROJECT_ID);
gcRequest.setSelectAll(true);
gcRequest.setExcludeIds(new ArrayList<>());
gcRequest.setApiDefinitionId("apiDefinitionId");
responsePost(BATCH_MOVE_GC, gcRequest);
ApiTestCaseExample example1 = new ApiTestCaseExample();
example1.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andApiDefinitionIdEqualTo("apiDefinitionId").andDeletedEqualTo(true);
List<ApiTestCase> caseList1 = apiTestCaseMapper.selectByExample(example1);
caseList1.forEach(apiTestCase -> Assertions.assertTrue(apiTestCase.getDeleted()));
} }
@ -916,7 +926,6 @@ public class ApiTestCaseControllerTests extends BaseTest {
responsePost(BATCH_DELETE, request); responsePost(BATCH_DELETE, request);
request.setProjectId(DEFAULT_PROJECT_ID); request.setProjectId(DEFAULT_PROJECT_ID);
request.setSelectAll(true); request.setSelectAll(true);
request.setModuleIds(List.of("case-moduleId"));
request.setApiDefinitionId("apiDefinitionId"); request.setApiDefinitionId("apiDefinitionId");
responsePost(BATCH_DELETE, request); responsePost(BATCH_DELETE, request);
ApiTestCaseExample example = new ApiTestCaseExample(); ApiTestCaseExample example = new ApiTestCaseExample();