add 公共方法,修改SQL查询中的%

This commit is contained in:
lijiarao
2021-10-11 16:06:25 +08:00
parent 23b7b41770
commit 7ba397325b
@@ -2,6 +2,7 @@ package com.jero.common.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
@@ -670,6 +671,10 @@ public class oConvertUtils {
* sql查询时替换所有%
*/
public static String replaceAllPercent(String value){
return value.replaceAll("%","\\\\%");
if (StringUtils.isNotBlank(value)){
return value.replaceAll("%","\\\\%");
}else {
return null;
}
}
}