From 7bc445659fca34806e8091e269afba2d3282da1e Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 26 Jun 2024 10:34:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1043148 --user=王旭 【测试计划】计划详情-功能用例详情-缺陷列表-输入_将所有缺陷都搜索出来了 https://www.tapd.cn/55049933/s/1536969 --- .../metersphere/request/BaseProviderCondition.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/framework/provider/src/main/java/io/metersphere/request/BaseProviderCondition.java b/backend/framework/provider/src/main/java/io/metersphere/request/BaseProviderCondition.java index 225e7bc63e..bcf9f392ba 100644 --- a/backend/framework/provider/src/main/java/io/metersphere/request/BaseProviderCondition.java +++ b/backend/framework/provider/src/main/java/io/metersphere/request/BaseProviderCondition.java @@ -2,6 +2,7 @@ package io.metersphere.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.Map; @@ -19,4 +20,16 @@ public class BaseProviderCondition { @Schema(description = "高级搜索") private Map combine; + + // 转JSON时会调用。 前台数据传过来时可以顺便处理掉转义字符 + public void setKeyword(String keyword) { + keyword = StringUtils.replace(keyword, "%", "\\%"); + keyword = StringUtils.replace(keyword, "_", "\\_"); + this.keyword = keyword; + } + + // 直接初始化keyword + public void initKeyword(String keyword) { + this.keyword = keyword; + } }