Commit 790c696014da54e51265c063b19a389feab2fb2f

Authored by 杨鸣坤
1 parent 035b05b0

匹配数据置空

@@ -25,6 +25,8 @@ import java.util.ArrayList; @@ -25,6 +25,8 @@ import java.util.ArrayList;
25 import java.util.List; 25 import java.util.List;
26 import java.util.Map; 26 import java.util.Map;
27 import java.util.Properties; 27 import java.util.Properties;
  28 +import java.util.regex.Matcher;
  29 +import java.util.regex.Pattern;
28 30
29 /** 31 /**
30 * 最终数据库连接查询 32 * 最终数据库连接查询
@@ -264,8 +266,10 @@ public class BaseDbConnectServiceImpl implements BaseDbConnectService { @@ -264,8 +266,10 @@ public class BaseDbConnectServiceImpl implements BaseDbConnectService {
264 } 266 }
265 267
266 private String replaceParam(String sql, Map<String, Object> paramMap) { 268 private String replaceParam(String sql, Map<String, Object> paramMap) {
  269 + Pattern pattern = Pattern.compile("\\$\\{[^}]*\\}");
267 if (MapUtils.isEmpty(paramMap)) { 270 if (MapUtils.isEmpty(paramMap)) {
268 - return sql; 271 + Matcher matcher = pattern.matcher(sql);
  272 + return matcher.replaceAll("");
269 } 273 }
270 274
271 for (Map.Entry<String, Object> objectEntry : paramMap.entrySet()) { 275 for (Map.Entry<String, Object> objectEntry : paramMap.entrySet()) {
@@ -278,7 +282,8 @@ public class BaseDbConnectServiceImpl implements BaseDbConnectService { @@ -278,7 +282,8 @@ public class BaseDbConnectServiceImpl implements BaseDbConnectService {
278 sql = sql.replaceAll("\\$\\{" + key + "\\}", String.valueOf(value)); 282 sql = sql.replaceAll("\\$\\{" + key + "\\}", String.valueOf(value));
279 } 283 }
280 284
281 - return sql; 285 + Matcher matcher = pattern.matcher(sql);
  286 + return matcher.replaceAll("");
282 } 287 }
283 288
284 private Object getTypedValue(ResultSet rs, int index, int sqlType) throws SQLException { 289 private Object getTypedValue(ResultSet rs, int index, int sqlType) throws SQLException {