Commit 20484ee4 authored by Quxl's avatar Quxl

x

parent 56410421
...@@ -8,6 +8,8 @@ import java.sql.SQLException; ...@@ -8,6 +8,8 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.egolm.common.StringUtil;
/** /**
* 数据库工具类 * 数据库工具类
* *
...@@ -68,14 +70,19 @@ public class SqlServerTo { ...@@ -68,14 +70,19 @@ public class SqlServerTo {
} }
} }
public void executeFilter(String sign) { public void execute(String... filters) {
try { try {
String sql = "SELECT D.name AS TABLE_NAME, 'REMARK' AS TABLE_COMMENT FROM sysobjects AS D WHERE D.XTYPE = 'U' AND D.NAME <> 'dtproperties'"; String sql = "SELECT D.name AS TABLE_NAME, 'REMARK' AS TABLE_COMMENT FROM sysobjects AS D WHERE D.XTYPE = 'U' AND D.NAME <> 'dtproperties'";
PreparedStatement pStemt = conn.prepareStatement(sql); PreparedStatement pStemt = conn.prepareStatement(sql);
ResultSet set = pStemt.executeQuery(); ResultSet set = pStemt.executeQuery();
while(set.next()) { while(set.next()) {
String name = set.getString("TABLE_NAME").trim(); String name = set.getString("TABLE_NAME").trim();
if(name.contains(sign)) { if(filters != null && filters.length > 0) {
if(StringUtil.contains(filters, name)) {
String comment = set.getString("TABLE_COMMENT");
execute(name, comment);
}
} else {
String comment = set.getString("TABLE_COMMENT"); String comment = set.getString("TABLE_COMMENT");
execute(name, comment); execute(name, comment);
} }
......
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