mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 09:38:26 +08:00
fix: replace 无法支持空格替换 #I84KMI
This commit is contained in:
parent
f189888d0f
commit
e1af38ac6a
@ -1005,7 +1005,7 @@ public class QueryMethods {
|
|||||||
* 用字符串 s2 代替字符串 s 中的字符串 s1。
|
* 用字符串 s2 代替字符串 s 中的字符串 s1。
|
||||||
*/
|
*/
|
||||||
public static QueryColumn replace(String columnS, String columnS1, String columnS2) {
|
public static QueryColumn replace(String columnS, String columnS1, String columnS2) {
|
||||||
return new FunctionQueryColumn(REPLACE, columnS, columnS1, columnS2);
|
return new StringFunctionQueryColumn(REPLACE, columnS, columnS1, columnS2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -96,5 +96,15 @@ public class FunctionSqlTest {
|
|||||||
|
|
||||||
System.out.println(sql);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user