diff --git a/backend/framework/domain/pom.xml b/backend/framework/domain/pom.xml
index dff32f19dd..f11c98d0a3 100644
--- a/backend/framework/domain/pom.xml
+++ b/backend/framework/domain/pom.xml
@@ -30,7 +30,14 @@
${mybatis-starter.version}
provided
-
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+
diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReview.java b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReview.java
index 6bc92e9c80..6edb4ce472 100644
--- a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReview.java
+++ b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReview.java
@@ -7,6 +7,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import lombok.Data;
@Data
@@ -63,7 +64,7 @@ public class CaseReview implements Serializable {
private BigDecimal passRate;
@Schema(description = "标签")
- private String tags;
+ private java.util.List tags;
@Schema(description = "描述")
private String description;
diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReviewExample.java b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReviewExample.java
index 7c7bb65f26..70e3569d0b 100644
--- a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReviewExample.java
+++ b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/CaseReviewExample.java
@@ -65,19 +65,50 @@ public class CaseReviewExample {
}
protected abstract static class GeneratedCriteria {
+ protected List tagsCriteria;
+
+ protected List allCriteria;
+
protected List criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList();
+ tagsCriteria = new ArrayList();
+ }
+
+ public List 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 value1, List 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() {
- return criteria.size() > 0;
+ return criteria.size() > 0
+ || tagsCriteria.size() > 0;
}
public List getAllCriteria() {
- return criteria;
+ if (allCriteria == null) {
+ allCriteria = new ArrayList();
+ allCriteria.addAll(criteria);
+ allCriteria.addAll(tagsCriteria);
+ }
+ return allCriteria;
}
public List getCriteria() {
@@ -89,6 +120,7 @@ public class CaseReviewExample {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
+ allCriteria = null;
}
protected void addCriterion(String condition, Object value, String property) {
@@ -96,6 +128,7 @@ public class CaseReviewExample {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
+ allCriteria = null;
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
@@ -103,6 +136,7 @@ public class CaseReviewExample {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
+ allCriteria = null;
}
public Criteria andIdIsNull() {
@@ -895,63 +929,63 @@ public class CaseReviewExample {
return (Criteria) this;
}
- public Criteria andTagsEqualTo(String value) {
- addCriterion("tags =", value, "tags");
+ public Criteria andTagsEqualTo(List value) {
+ addTagsCriterion("tags =", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotEqualTo(String value) {
- addCriterion("tags <>", value, "tags");
+ public Criteria andTagsNotEqualTo(List value) {
+ addTagsCriterion("tags <>", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsGreaterThan(String value) {
- addCriterion("tags >", value, "tags");
+ public Criteria andTagsGreaterThan(List value) {
+ addTagsCriterion("tags >", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsGreaterThanOrEqualTo(String value) {
- addCriterion("tags >=", value, "tags");
+ public Criteria andTagsGreaterThanOrEqualTo(List value) {
+ addTagsCriterion("tags >=", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsLessThan(String value) {
- addCriterion("tags <", value, "tags");
+ public Criteria andTagsLessThan(List value) {
+ addTagsCriterion("tags <", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsLessThanOrEqualTo(String value) {
- addCriterion("tags <=", value, "tags");
+ public Criteria andTagsLessThanOrEqualTo(List value) {
+ addTagsCriterion("tags <=", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsLike(String value) {
- addCriterion("tags like", value, "tags");
+ public Criteria andTagsLike(List value) {
+ addTagsCriterion("tags like", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotLike(String value) {
- addCriterion("tags not like", value, "tags");
+ public Criteria andTagsNotLike(List value) {
+ addTagsCriterion("tags not like", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsIn(List values) {
- addCriterion("tags in", values, "tags");
+ public Criteria andTagsIn(List> values) {
+ addTagsCriterion("tags in", values, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotIn(List values) {
- addCriterion("tags not in", values, "tags");
+ public Criteria andTagsNotIn(List> values) {
+ addTagsCriterion("tags not in", values, "tags");
return (Criteria) this;
}
- public Criteria andTagsBetween(String value1, String value2) {
- addCriterion("tags between", value1, value2, "tags");
+ public Criteria andTagsBetween(List value1, List value2) {
+ addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotBetween(String value1, String value2) {
- addCriterion("tags not between", value1, value2, "tags");
+ public Criteria andTagsNotBetween(List value1, List value2) {
+ addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}
diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCase.java b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCase.java
index ce3826604e..e86e374a77 100644
--- a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCase.java
+++ b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCase.java
@@ -6,6 +6,7 @@ import jakarta.validation.constraints.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import lombok.Data;
@Data
@@ -44,7 +45,7 @@ public class FunctionalCase implements Serializable {
private String reviewStatus;
@Schema(description = "标签(JSON)")
- private String tags;
+ private java.util.List tags;
@Schema(description = "编辑模式:步骤模式/文本模式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case.case_edit_type.not_blank}", groups = {Created.class})
diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseExample.java b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseExample.java
index 02f4e5b88d..b573fe652b 100644
--- a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseExample.java
+++ b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseExample.java
@@ -64,19 +64,50 @@ public class FunctionalCaseExample {
}
protected abstract static class GeneratedCriteria {
+ protected List tagsCriteria;
+
+ protected List allCriteria;
+
protected List criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList();
+ tagsCriteria = new ArrayList();
+ }
+
+ public List 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 value1, List 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() {
- return criteria.size() > 0;
+ return criteria.size() > 0
+ || tagsCriteria.size() > 0;
}
public List getAllCriteria() {
- return criteria;
+ if (allCriteria == null) {
+ allCriteria = new ArrayList();
+ allCriteria.addAll(criteria);
+ allCriteria.addAll(tagsCriteria);
+ }
+ return allCriteria;
}
public List getCriteria() {
@@ -88,6 +119,7 @@ public class FunctionalCaseExample {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
+ allCriteria = null;
}
protected void addCriterion(String condition, Object value, String property) {
@@ -95,6 +127,7 @@ public class FunctionalCaseExample {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
+ allCriteria = null;
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
@@ -102,6 +135,7 @@ public class FunctionalCaseExample {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
+ allCriteria = null;
}
public Criteria andIdIsNull() {
@@ -594,63 +628,63 @@ public class FunctionalCaseExample {
return (Criteria) this;
}
- public Criteria andTagsEqualTo(String value) {
- addCriterion("tags =", value, "tags");
+ public Criteria andTagsEqualTo(List value) {
+ addTagsCriterion("tags =", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotEqualTo(String value) {
- addCriterion("tags <>", value, "tags");
+ public Criteria andTagsNotEqualTo(List value) {
+ addTagsCriterion("tags <>", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsGreaterThan(String value) {
- addCriterion("tags >", value, "tags");
+ public Criteria andTagsGreaterThan(List value) {
+ addTagsCriterion("tags >", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsGreaterThanOrEqualTo(String value) {
- addCriterion("tags >=", value, "tags");
+ public Criteria andTagsGreaterThanOrEqualTo(List value) {
+ addTagsCriterion("tags >=", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsLessThan(String value) {
- addCriterion("tags <", value, "tags");
+ public Criteria andTagsLessThan(List value) {
+ addTagsCriterion("tags <", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsLessThanOrEqualTo(String value) {
- addCriterion("tags <=", value, "tags");
+ public Criteria andTagsLessThanOrEqualTo(List value) {
+ addTagsCriterion("tags <=", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsLike(String value) {
- addCriterion("tags like", value, "tags");
+ public Criteria andTagsLike(List value) {
+ addTagsCriterion("tags like", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotLike(String value) {
- addCriterion("tags not like", value, "tags");
+ public Criteria andTagsNotLike(List value) {
+ addTagsCriterion("tags not like", value, "tags");
return (Criteria) this;
}
- public Criteria andTagsIn(List values) {
- addCriterion("tags in", values, "tags");
+ public Criteria andTagsIn(List> values) {
+ addTagsCriterion("tags in", values, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotIn(List values) {
- addCriterion("tags not in", values, "tags");
+ public Criteria andTagsNotIn(List> values) {
+ addTagsCriterion("tags not in", values, "tags");
return (Criteria) this;
}
- public Criteria andTagsBetween(String value1, String value2) {
- addCriterion("tags between", value1, value2, "tags");
+ public Criteria andTagsBetween(List value1, List value2) {
+ addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this;
}
- public Criteria andTagsNotBetween(String value1, String value2) {
- addCriterion("tags not between", value1, value2, "tags");
+ public Criteria andTagsNotBetween(List value1, List value2) {
+ addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}
diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/CaseReviewMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/CaseReviewMapper.xml
index 2210f61a43..ee252659a0 100644
--- a/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/CaseReviewMapper.xml
+++ b/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/CaseReviewMapper.xml
@@ -14,7 +14,7 @@
-
+
@@ -45,6 +45,25 @@
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition}
+
+ #{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+
+
@@ -74,6 +93,25 @@
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition}
+
+ #{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+
+
@@ -119,16 +157,16 @@
module_id, project_id, `status`,
review_pass_rule, pos, start_time,
end_time, case_count, pass_rate,
- tags, description, create_time,
- create_user, update_time, update_user
- )
+ tags, description,
+ create_time, create_user, update_time,
+ update_user)
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{moduleId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{reviewPassRule,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{caseCount,jdbcType=INTEGER}, #{passRate,jdbcType=DECIMAL},
- #{tags,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
- #{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}
- )
+ #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}, #{description,jdbcType=VARCHAR},
+ #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
+ #{updateUser,jdbcType=VARCHAR})
insert into case_review
@@ -226,7 +264,7 @@
#{passRate,jdbcType=DECIMAL},
- #{tags,jdbcType=VARCHAR},
+ #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{description,jdbcType=VARCHAR},
@@ -291,7 +329,7 @@
pass_rate = #{record.passRate,jdbcType=DECIMAL},
- tags = #{record.tags,jdbcType=VARCHAR},
+ tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
description = #{record.description,jdbcType=VARCHAR},
@@ -327,7 +365,7 @@
end_time = #{record.endTime,jdbcType=BIGINT},
case_count = #{record.caseCount,jdbcType=INTEGER},
pass_rate = #{record.passRate,jdbcType=DECIMAL},
- tags = #{record.tags,jdbcType=VARCHAR},
+ tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
@@ -374,7 +412,7 @@
pass_rate = #{passRate,jdbcType=DECIMAL},
- tags = #{tags,jdbcType=VARCHAR},
+ tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
description = #{description,jdbcType=VARCHAR},
@@ -407,7 +445,7 @@
end_time = #{endTime,jdbcType=BIGINT},
case_count = #{caseCount,jdbcType=INTEGER},
pass_rate = #{passRate,jdbcType=DECIMAL},
- tags = #{tags,jdbcType=VARCHAR},
+ tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
@@ -426,9 +464,9 @@
#{item.moduleId,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
#{item.reviewPassRule,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.startTime,jdbcType=BIGINT},
#{item.endTime,jdbcType=BIGINT}, #{item.caseCount,jdbcType=INTEGER}, #{item.passRate,jdbcType=DECIMAL},
- #{item.tags,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
- #{item.createUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}
- )
+ #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
+ #{item.description,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
+ #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR})
@@ -478,7 +516,7 @@
#{item.passRate,jdbcType=DECIMAL}
- #{item.tags,jdbcType=VARCHAR}
+ #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
#{item.description,jdbcType=VARCHAR}
diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseMapper.xml
index 7d976be6ff..74d28d91c4 100644
--- a/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseMapper.xml
+++ b/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseMapper.xml
@@ -9,7 +9,7 @@
-
+
@@ -49,6 +49,25 @@
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition}
+
+ #{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+
+
@@ -78,6 +97,25 @@
+
+
+
+ and ${criterion.condition}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+ and ${criterion.condition}
+
+ #{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
+
+
+
+
@@ -121,20 +159,20 @@
insert into functional_case (id, num, module_id,
project_id, template_id, `name`,
- review_status, tags, case_edit_type,
- pos, version_id, ref_id,
- last_execute_result, deleted, public_case,
- latest, create_user, update_user,
- delete_user, create_time, update_time,
- delete_time)
+ review_status, tags,
+ case_edit_type, pos, version_id,
+ ref_id, last_execute_result, deleted,
+ public_case, latest, create_user,
+ update_user, delete_user, create_time,
+ update_time, delete_time)
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{moduleId,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
- #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{caseEditType,jdbcType=VARCHAR},
- #{pos,jdbcType=BIGINT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
- #{lastExecuteResult,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{publicCase,jdbcType=BIT},
- #{latest,jdbcType=BIT}, #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR},
- #{deleteUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
- #{deleteTime,jdbcType=BIGINT})
+ #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
+ #{caseEditType,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{versionId,jdbcType=VARCHAR},
+ #{refId,jdbcType=VARCHAR}, #{lastExecuteResult,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT},
+ #{publicCase,jdbcType=BIT}, #{latest,jdbcType=BIT}, #{createUser,jdbcType=VARCHAR},
+ #{updateUser,jdbcType=VARCHAR}, #{deleteUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
+ #{updateTime,jdbcType=BIGINT}, #{deleteTime,jdbcType=BIGINT})
insert into functional_case
@@ -229,7 +267,7 @@
#{reviewStatus,jdbcType=VARCHAR},
- #{tags,jdbcType=VARCHAR},
+ #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{caseEditType,jdbcType=VARCHAR},
@@ -306,7 +344,7 @@
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
- tags = #{record.tags,jdbcType=VARCHAR},
+ tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
case_edit_type = #{record.caseEditType,jdbcType=VARCHAR},
@@ -364,7 +402,7 @@
template_id = #{record.templateId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
- tags = #{record.tags,jdbcType=VARCHAR},
+ tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
case_edit_type = #{record.caseEditType,jdbcType=VARCHAR},
pos = #{record.pos,jdbcType=BIGINT},
version_id = #{record.versionId,jdbcType=VARCHAR},
@@ -405,7 +443,7 @@
review_status = #{reviewStatus,jdbcType=VARCHAR},
- tags = #{tags,jdbcType=VARCHAR},
+ tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
case_edit_type = #{caseEditType,jdbcType=VARCHAR},
@@ -460,7 +498,7 @@
template_id = #{templateId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR},
- tags = #{tags,jdbcType=VARCHAR},
+ tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
case_edit_type = #{caseEditType,jdbcType=VARCHAR},
pos = #{pos,jdbcType=BIGINT},
version_id = #{versionId,jdbcType=VARCHAR},
@@ -486,12 +524,12 @@
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.moduleId,jdbcType=VARCHAR},
#{item.projectId,jdbcType=VARCHAR}, #{item.templateId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
- #{item.reviewStatus,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR}, #{item.caseEditType,jdbcType=VARCHAR},
- #{item.pos,jdbcType=BIGINT}, #{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR},
- #{item.lastExecuteResult,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, #{item.publicCase,jdbcType=BIT},
- #{item.latest,jdbcType=BIT}, #{item.createUser,jdbcType=VARCHAR}, #{item.updateUser,jdbcType=VARCHAR},
- #{item.deleteUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
- #{item.deleteTime,jdbcType=BIGINT})
+ #{item.reviewStatus,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
+ #{item.caseEditType,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.versionId,jdbcType=VARCHAR},
+ #{item.refId,jdbcType=VARCHAR}, #{item.lastExecuteResult,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT},
+ #{item.publicCase,jdbcType=BIT}, #{item.latest,jdbcType=BIT}, #{item.createUser,jdbcType=VARCHAR},
+ #{item.updateUser,jdbcType=VARCHAR}, #{item.deleteUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
+ #{item.updateTime,jdbcType=BIGINT}, #{item.deleteTime,jdbcType=BIGINT})
@@ -526,7 +564,7 @@
#{item.reviewStatus,jdbcType=VARCHAR}
- #{item.tags,jdbcType=VARCHAR}
+ #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
#{item.caseEditType,jdbcType=VARCHAR}
diff --git a/backend/framework/domain/src/main/java/io/metersphere/handler/BaseTypeHandler.java b/backend/framework/domain/src/main/java/io/metersphere/handler/BaseTypeHandler.java
new file mode 100644
index 0000000000..f21c781b51
--- /dev/null
+++ b/backend/framework/domain/src/main/java/io/metersphere/handler/BaseTypeHandler.java
@@ -0,0 +1,45 @@
+package io.metersphere.handler;
+
+import org.apache.ibatis.type.JdbcType;
+import org.apache.ibatis.type.TypeHandler;
+import org.apache.ibatis.type.TypeReference;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public abstract class BaseTypeHandler extends TypeReference implements TypeHandler {
+
+ @Override
+ public void setParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {
+ if (parameter == null) {
+ ps.setNull(i, jdbcType.TYPE_CODE);
+ } else {
+ setNonNullParameter(ps, i, parameter, jdbcType);
+ }
+ }
+
+ @Override
+ public T getResult(ResultSet rs, String columnName) throws SQLException {
+ return getNullableResult(rs, columnName);
+ }
+
+ @Override
+ public T getResult(ResultSet rs, int columnIndex) throws SQLException {
+ return getNullableResult(rs, columnIndex);
+ }
+
+ @Override
+ public T getResult(CallableStatement cs, int columnIndex) throws SQLException {
+ return getNullableResult(cs, columnIndex);
+ }
+
+ public abstract void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException;
+
+ public abstract T getNullableResult(ResultSet rs, String columnName) throws SQLException;
+
+ public abstract T getNullableResult(ResultSet rs, int columnIndex) throws SQLException;
+
+ public abstract T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException;
+}
diff --git a/backend/framework/domain/src/main/java/io/metersphere/handler/ListTypeHandler.java b/backend/framework/domain/src/main/java/io/metersphere/handler/ListTypeHandler.java
new file mode 100644
index 0000000000..80eb015a2a
--- /dev/null
+++ b/backend/framework/domain/src/main/java/io/metersphere/handler/ListTypeHandler.java
@@ -0,0 +1,99 @@
+package io.metersphere.handler;
+
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.StreamReadConstraints;
+import com.fasterxml.jackson.core.json.JsonReadFeature;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.databind.type.CollectionType;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import io.micrometer.common.util.StringUtils;
+import org.apache.ibatis.type.JdbcType;
+
+import java.io.IOException;
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ListTypeHandler extends BaseTypeHandler>{
+ @Override
+ public void setNonNullParameter(PreparedStatement ps, int i, List parameter, JdbcType jdbcType) throws SQLException {
+ String d = toJSONString(parameter);
+ ps.setString(i, d);
+ }
+
+ @Override
+ public List getNullableResult(ResultSet rs, String columnName) throws SQLException {
+ String values = rs.getString(columnName);
+ return getResults(values);
+ }
+
+ @Override
+ public List getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
+ String values = rs.getString(columnIndex);
+ return getResults(values);
+ }
+
+ @Override
+ public List getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
+ String values = cs.getString(columnIndex);
+ return getResults(values);
+ }
+
+ private List getResults(String values) {
+ if (StringUtils.isNotBlank(values)) {
+ return parseArray(values, String.class);
+ }
+ return new ArrayList<>();
+ }
+
+ private static final ObjectMapper objectMapper = JsonMapper.builder()
+ .enable(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS)
+ .build();
+ private static final TypeFactory typeFactory = objectMapper.getTypeFactory();
+
+ public static final int DEFAULT_MAX_STRING_LEN = 20_000_000_0;
+
+ static {
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ // 支持json字符中带注释符
+ objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+ // 自动检测所有类的全部属性
+ objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
+ // 如果一个对象中没有任何的属性,那么在序列化的时候就会报错
+ objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+ objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
+ // 设置JSON处理字符长度限制
+ objectMapper.getFactory()
+ .setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
+ // 处理时间格式
+ objectMapper.registerModule(new JavaTimeModule());
+
+ }
+
+ public static String toJSONString(Object value) {
+ try {
+ return objectMapper.writeValueAsString(value);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static List parseArray(String content, Class valueType) {
+ CollectionType javaType = typeFactory.constructCollectionType(List.class, valueType);
+ try {
+ return objectMapper.readValue(content, javaType);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
index 0b364ca65e..61bc659281 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
@@ -530,7 +530,7 @@
update functional_case
- tags = #{functionalCase.tags},
+ tags = #{functionalCase.tags,typeHandler=io.metersphere.handler.ListTypeHandler},
update_user = #{functionalCase.updateUser},
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewNoticeService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewNoticeService.java
index a64f1a206d..1ea3b465fa 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewNoticeService.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewNoticeService.java
@@ -5,7 +5,6 @@ import io.metersphere.functional.domain.CaseReview;
import io.metersphere.functional.mapper.CaseReviewMapper;
import io.metersphere.functional.mapper.ExtCaseReviewMapper;
import io.metersphere.functional.request.CaseReviewRequest;
-import io.metersphere.sdk.util.JSON;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -39,7 +38,7 @@ public class CaseReviewNoticeService {
caseReview.setCreateUser(null);
}
if (CollectionUtils.isNotEmpty(request.getTags())) {
- caseReview.setTags(JSON.toJSONString(request.getTags()));
+ caseReview.setTags(request.getTags());
}
caseReview.setStartTime(request.getStartTime());
caseReview.setEndTime(request.getEndTime());
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java
index 39e75defd9..f3405560f6 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewService.java
@@ -17,7 +17,6 @@ import io.metersphere.sdk.constants.ApplicationNumScope;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils;
-import io.metersphere.sdk.util.JSON;
import io.metersphere.system.domain.User;
import io.metersphere.system.dto.sdk.request.PosRequest;
import io.metersphere.system.mapper.ExtUserMapper;
@@ -261,7 +260,7 @@ public class CaseReviewService {
caseReview.setName(request.getName());
caseReview.setModuleId(request.getModuleId());
if (CollectionUtils.isNotEmpty(request.getTags())) {
- caseReview.setTags(JSON.toJSONString(request.getTags()));
+ caseReview.setTags(request.getTags());
}
caseReview.setStartTime(request.getStartTime());
caseReview.setEndTime(request.getEndTime());
@@ -333,7 +332,7 @@ public class CaseReviewService {
caseReview.setReviewPassRule(request.getReviewPassRule());
caseReview.setPos(getNextPos(request.getProjectId()));
if (CollectionUtils.isNotEmpty(request.getTags())) {
- caseReview.setTags(JSON.toJSONString(request.getTags()));
+ caseReview.setTags(request.getTags());
}
caseReview.setPassRate(BigDecimal.valueOf(0.00));
if (CollectionUtils.isEmpty(caseIds)) {
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java
index 9a76823fb3..1674352efc 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java
@@ -152,7 +152,7 @@ public class FunctionalCaseService {
functionalCase.setCreateTime(System.currentTimeMillis());
functionalCase.setUpdateTime(System.currentTimeMillis());
functionalCase.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId())));
- functionalCase.setTags(JSON.toJSONString(request.getTags()));
+ functionalCase.setTags(request.getTags());
functionalCaseMapper.insertSelective(functionalCase);
//附属表
FunctionalCaseBlob functionalCaseBlob = new FunctionalCaseBlob();
@@ -643,13 +643,13 @@ public class FunctionalCaseService {
FunctionalCaseMapper caseMapper = sqlSession.getMapper(FunctionalCaseMapper.class);
ids.forEach(id -> {
FunctionalCase functionalCase = new FunctionalCase();
- if (StringUtils.isNotBlank(collect.get(id).getTags())) {
- List tags = JSON.parseArray(collect.get(id).getTags(), String.class);
+ if (CollectionUtils.isNotEmpty(collect.get(id).getTags())) {
+ List tags = collect.get(id).getTags();
tags.addAll(request.getTags());
List newTags = tags.stream().distinct().collect(Collectors.toList());
- functionalCase.setTags(JSON.toJSONString(newTags));
+ functionalCase.setTags(newTags);
} else {
- functionalCase.setTags(JSON.toJSONString(request.getTags()));
+ functionalCase.setTags(request.getTags());
}
functionalCase.setId(id);
functionalCase.setUpdateTime(System.currentTimeMillis());
@@ -661,7 +661,7 @@ public class FunctionalCaseService {
} else {
//替换标签
FunctionalCase functionalCase = new FunctionalCase();
- functionalCase.setTags(JSON.toJSONString(request.getTags()));
+ functionalCase.setTags(request.getTags());
functionalCase.setProjectId(request.getProjectId());
functionalCase.setUpdateTime(System.currentTimeMillis());
functionalCase.setUpdateUser(userId);
diff --git a/backend/services/case-management/src/main/resources/functionalGeneratorConfig.xml b/backend/services/case-management/src/main/resources/functionalGeneratorConfig.xml
index 3e03f2da4e..e4d33f93bb 100644
--- a/backend/services/case-management/src/main/resources/functionalGeneratorConfig.xml
+++ b/backend/services/case-management/src/main/resources/functionalGeneratorConfig.xml
@@ -70,22 +70,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java
index 4dbba0f0bf..8115cdf4e7 100644
--- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java
+++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java
@@ -252,6 +252,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
Assertions.assertNotNull(functionalCaseTestDTOS);
}
+
private List getModuleTreeNode() throws Exception {
MvcResult result = this.requestPostWithOkAndReturn(URL_CASE_MODULE_TREE, new AssociateCaseModuleRequest() {{
this.setProtocol("HTTP");
@@ -299,6 +300,10 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
functionalCase.setCreateTime(System.currentTimeMillis());
functionalCase.setUpdateUser("gyq");
functionalCase.setUpdateTime(System.currentTimeMillis());
+ Listtags = new ArrayList<>();
+ tags.add("111");
+ tags.add("222");
+ functionalCase.setTags(tags);
functionalCaseMapper.insertSelective(functionalCase);
}