add 公共方法,修改SQL查询中的%
This commit is contained in:
+6
@@ -482,6 +482,12 @@ public class QueryGenerator {
|
||||
if (value == null || rule == null || oConvertUtils.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//对"_"与"%"的替换
|
||||
if (value instanceof String){
|
||||
value = ((String) value).replaceAll("_", "\\\\_").replaceAll("%","\\\\%");
|
||||
}
|
||||
|
||||
name = oConvertUtils.camelToUnderline(name);
|
||||
log.info("--查询规则-->"+name+" "+rule.getValue()+" "+value);
|
||||
switch (rule) {
|
||||
|
||||
+7
@@ -665,4 +665,11 @@ public class oConvertUtils {
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* sql查询时替换所有%
|
||||
*/
|
||||
public static String replaceAllPercent(String value){
|
||||
return value.replaceAll("%","\\\\%");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user