add 公共方法,修改SQL查询中的%
This commit is contained in:
+6
-1
@@ -2,6 +2,7 @@ package com.jero.common.util;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -670,6 +671,10 @@ public class oConvertUtils {
|
|||||||
* sql查询时替换所有%
|
* sql查询时替换所有%
|
||||||
*/
|
*/
|
||||||
public static String replaceAllPercent(String value){
|
public static String replaceAllPercent(String value){
|
||||||
return value.replaceAll("%","\\\\%");
|
if (StringUtils.isNotBlank(value)){
|
||||||
|
return value.replaceAll("%","\\\\%");
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user