refactor(用例管理): 高级搜索数据结构优化
--task=1016127 --user=陈建星 高级搜索-高级搜索数据结构设计-后端 https://www.tapd.cn/55049933/s/1570894
This commit is contained in:
parent
af6ea7cc78
commit
dba11130cd
|
@ -2,6 +2,7 @@ package io.metersphere.system.dto.sdk;
|
||||||
|
|
||||||
import io.metersphere.system.valid.EnumValue;
|
import io.metersphere.system.valid.EnumValue;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -18,6 +19,10 @@ public class CombineCondition {
|
||||||
@Schema(description = "期望值, BETWEEN,IN,NOT_IN 时为数组, 其他为单值")
|
@Schema(description = "期望值, BETWEEN,IN,NOT_IN 时为数组, 其他为单值")
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|
||||||
|
@Schema(description = "是否是自定义字段")
|
||||||
|
@NotNull
|
||||||
|
private Boolean customField = false;
|
||||||
|
|
||||||
@Schema(description = "操作符",
|
@Schema(description = "操作符",
|
||||||
allowableValues = {"IN", "NOT_IN", "BETWEEN", "GT", "LT", "EQUALS", "NOT_EQUALS", "CONTAINS", "NOT_CONTAINS", "EMPTY", "NOT_EMPTY", "CURRENT_USER"})
|
allowableValues = {"IN", "NOT_IN", "BETWEEN", "GT", "LT", "EQUALS", "NOT_EQUALS", "CONTAINS", "NOT_CONTAINS", "EMPTY", "NOT_EMPTY", "CURRENT_USER"})
|
||||||
@EnumValue(enumClass = CombineConditionOperator.class)
|
@EnumValue(enumClass = CombineConditionOperator.class)
|
||||||
|
|
|
@ -22,10 +22,6 @@ public class CombineSearch {
|
||||||
@Valid
|
@Valid
|
||||||
private List<CombineCondition> conditions;
|
private List<CombineCondition> conditions;
|
||||||
|
|
||||||
@Schema(description = "自定义字段筛选条件")
|
|
||||||
@Valid
|
|
||||||
private List<CombineCondition> customFileConditions;
|
|
||||||
|
|
||||||
public List<CombineCondition> getValidConditions(List<CombineCondition> conditions) {
|
public List<CombineCondition> getValidConditions(List<CombineCondition> conditions) {
|
||||||
return conditions.stream().filter(CombineCondition::valid).toList();
|
return conditions.stream().filter(CombineCondition::valid).toList();
|
||||||
}
|
}
|
||||||
|
@ -34,10 +30,6 @@ public class CombineSearch {
|
||||||
return getValidConditions(conditions);
|
return getValidConditions(conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CombineCondition> getCustomFileConditions() {
|
|
||||||
return getValidConditions(customFileConditions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSearchMode() {
|
public String getSearchMode() {
|
||||||
return StringUtils.isBlank(searchMode) ? SearchMode.AND.name() : searchMode;
|
return StringUtils.isBlank(searchMode) ? SearchMode.AND.name() : searchMode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue