Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private static String removeComments(String input) {
// 移除 -- 注释(直至行尾)
input = input.replaceAll("(?m)--.*?$", "");
// 移除 /**/ 块注释
input = input.replaceAll("/\\*.*?\\*/", "");
// input = input.replaceAll("/\\*.*?\\*/", "");
return input;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.github.future0923.debug.tools.base.hutool.sql.SqlCompressor;
import io.github.future0923.debug.tools.base.hutool.sql.SqlFormatter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.List;
Expand All @@ -38,6 +39,9 @@ void compressSql() {

String compressed = SqlCompressor.compressSql(sql);
System.out.println(compressed);
String expect =
"SELECT * FROM user WHERE name = '张 三' AND age > 18 /* 这里是块注释,描述条件 */ AND remark = \"备注 换行\"";
Assertions.assertEquals(expect, compressed);
}

@Test
Expand Down