From 03f384ab49b902c488fb51ba595afb34aedef4cd Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Wed, 23 Oct 2024 16:45:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20m?= =?UTF-8?q?ock=E7=AD=9B=E9=80=89=E6=A8=A1=E5=9D=97=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E8=BD=AC=E4=B9=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047902 --user=宋昌昌 【接口测试】定义-MOCK-高级搜索-存在期望名称为「1·11_copy」的期望-筛选条件期望名称不等于「1·11_copy」-筛选后未过滤掉该期望 https://www.tapd.cn/55049933/s/1596629 --- .../system/interceptor/BaseConditionFilterAspect.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java b/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java index 26521c2e31..2cfec4dcb7 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/interceptor/BaseConditionFilterAspect.java @@ -1,4 +1,5 @@ package io.metersphere.system.interceptor; + import io.metersphere.sdk.dto.BaseCondition; import io.metersphere.sdk.dto.CombineCondition; import io.metersphere.sdk.dto.CombineSearch; @@ -6,7 +7,7 @@ import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.JSON; import io.metersphere.system.constants.InternalUserView; import io.metersphere.system.dto.UserViewDTO; -import io.metersphere.system.dto.sdk.*; +import io.metersphere.system.dto.sdk.DBCombineSearch; import io.metersphere.system.utils.SessionUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; @@ -67,7 +68,8 @@ public class BaseConditionFilterAspect { List validConditions = getValidConditions(combineSearch.getConditions()); validConditions.forEach(item -> { if (item.getValue() != null && item.getValue() instanceof String strValue - && !StringUtils.equals(item.getOperator(), CombineCondition.CombineConditionOperator.EQUALS.name())) { + && StringUtils.equalsAny(item.getOperator(), CombineCondition.CombineConditionOperator.CONTAINS.name(), + CombineCondition.CombineConditionOperator.NOT_CONTAINS.name())) { // 转义 mysql 的特殊字符 item.setValue(BaseCondition.transferKeyword(strValue)); }