Commit 74e083d5 authored by yanzg's avatar yanzg

压缩视频

parent 5f2e30c0
...@@ -575,14 +575,18 @@ public abstract class BaseDaoSql { ...@@ -575,14 +575,18 @@ public abstract class BaseDaoSql {
// 正则表达式匹配代码片段,并根据代码片段获取数组进行增加 // 正则表达式匹配代码片段,并根据代码片段获取数组进行增加
String regex = "\\{.*?\\}"; String regex = "\\{.*?\\}";
Pattern p = Pattern.compile(regex); Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(sql);
// 寻找到的代码片段 不包含分括号 do {
while (m.find()) { Matcher m = p.matcher(sql);
if (!m.find()) {
break;
}
// 寻找到的代码片段 不包含分括号
String name = m.group(); String name = m.group();
List<String> codes = codeMap.containsKey(name) ? codeMap.get(name) : new ArrayList<>(); List<String> codes = codeMap.containsKey(name) ? codeMap.get(name) : new ArrayList<>();
String code = String.format(" %s ", String.join(" ", codes)); String code = String.format(" %s ", String.join(" ", codes));
sql = sql.replace(name, code); sql = sql.replace(name, code);
} } while (true);
sql = sql.replaceAll("\\s+", " "); sql = sql.replaceAll("\\s+", " ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment