fix(测试计划): 修复测试计划场景无法精确查找sql特殊字符的缺陷

--bug=1044202 --user=宋天阳  https://www.tapd.cn/55049933/s/1550788
This commit is contained in:
Jianguo-Genius 2024-07-18 19:25:14 +08:00 committed by Craftsman
parent 02b93ec4f3
commit 1d145dd6e6

View File

@ -23,13 +23,18 @@ public class BaseCondition {
// 转JSON时会调用 前台数据传过来时可以顺便处理掉转义字符
public void setKeyword(String keyword) {
keyword = StringUtils.replace(keyword, "%", "\\%");
keyword = StringUtils.replace(keyword, "_", "\\_");
//判断之前有没有转义过转义过就不再转义耍花活的自己想办法解决
if (StringUtils.contains(keyword, "%") && !StringUtils.contains(keyword, "\\%")) {
keyword = StringUtils.replace(keyword, "%", "\\%");
}
if (StringUtils.contains(keyword, "_") && !StringUtils.contains(keyword, "\\_")) {
keyword = StringUtils.replace(keyword, "_", "\\_");
}
this.keyword = keyword;
}
// 直接初始化keyword
public void initKeyword(String keyword) {
// 直接初始化keyword
this.keyword = keyword;
}
}