fix: replace 无法支持空格替换 #I84KMI

This commit is contained in:
开源海哥 2023-09-27 08:49:53 +08:00
parent f189888d0f
commit e1af38ac6a
2 changed files with 11 additions and 1 deletions

View File

@ -1005,7 +1005,7 @@ public class QueryMethods {
* 用字符串 s2 代替字符串 s 中的字符串 s1
*/
public static QueryColumn replace(String columnS, String columnS1, String columnS2) {
return new FunctionQueryColumn(REPLACE, columnS, columnS1, columnS2);
return new StringFunctionQueryColumn(REPLACE, columnS, columnS1, columnS2);
}
/**

View File

@ -96,5 +96,15 @@ public class FunctionSqlTest {
System.out.println(sql);
}
@Test
public void testReplaceString() {
String sql = QueryWrapper.create()
.select(ACCOUNT.USER_NAME)
.from(ACCOUNT)
.where(ACCOUNT.USER_NAME.eq(replace("nsg_contract.primer_name","' '","''")))
.toSQL();
System.out.println(sql);
}
}