fix(测试计划): 缺陷列表搜索错误

--bug=1043148 --user=王旭 【测试计划】计划详情-功能用例详情-缺陷列表-输入_将所有缺陷都搜索出来了 https://www.tapd.cn/55049933/s/1536969
This commit is contained in:
WangXu10 2024-06-26 10:34:04 +08:00 committed by Craftsman
parent 5fb19aa6de
commit 7bc445659f
1 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.request;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -19,4 +20,16 @@ public class BaseProviderCondition {
@Schema(description = "高级搜索") @Schema(description = "高级搜索")
private Map<String, Object> combine; private Map<String, Object> 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;
}
} }