refactor(用例管理): 高级搜索数据结构优化

--task=1016127 --user=陈建星 高级搜索-高级搜索数据结构设计-后端 https://www.tapd.cn/55049933/s/1570894
This commit is contained in:
AgAngle 2024-08-30 14:58:39 +08:00 committed by Craftsman
parent af6ea7cc78
commit dba11130cd
2 changed files with 5 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.system.dto.sdk;
import io.metersphere.system.valid.EnumValue;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
@ -18,6 +19,10 @@ public class CombineCondition {
@Schema(description = "期望值, BETWEEN,IN,NOT_IN 时为数组, 其他为单值")
private Object value;
@Schema(description = "是否是自定义字段")
@NotNull
private Boolean customField = false;
@Schema(description = "操作符",
allowableValues = {"IN", "NOT_IN", "BETWEEN", "GT", "LT", "EQUALS", "NOT_EQUALS", "CONTAINS", "NOT_CONTAINS", "EMPTY", "NOT_EMPTY", "CURRENT_USER"})
@EnumValue(enumClass = CombineConditionOperator.class)

View File

@ -22,10 +22,6 @@ public class CombineSearch {
@Valid
private List<CombineCondition> conditions;
@Schema(description = "自定义字段筛选条件")
@Valid
private List<CombineCondition> customFileConditions;
public List<CombineCondition> getValidConditions(List<CombineCondition> conditions) {
return conditions.stream().filter(CombineCondition::valid).toList();
}
@ -34,10 +30,6 @@ public class CombineSearch {
return getValidConditions(conditions);
}
public List<CombineCondition> getCustomFileConditions() {
return getValidConditions(customFileConditions);
}
public String getSearchMode() {
return StringUtils.isBlank(searchMode) ? SearchMode.AND.name() : searchMode;
}