使用apache的
org.apache.commons.io.FilenameUtils.
wildcardMatch(final String filename, final String wildcardMatcher)
表名过滤(多个通配符以 ; 分割)
List<String> tables = jdbcUtils.getTables(bean); List<String> filterTables = new ArrayList<>();
if (CollectScopeEnum.Full.getCollectScope().equals(collectScope)) { //全部 filterTables = tables; } else if (CollectScopeEnum.Include.getCollectScope().equals(collectScope)) { //包含 String[] split = collectText.split(";"); if (!CollectionUtils.isEmpty(tables)) { for (String table : tables) { for (int i = 0; i < split.length; i++) { if (wildcardMatch(table, split[i])) { filterTables.add(table); } } } } } else if (CollectScopeEnum.Exclude.getCollectScope().equals(collectScope)) { //排除 String[] split = collectText.split(";"); if (!CollectionUtils.isEmpty(tables)) { filterTables = tables; for (int i = filterTables.size() - 1; i >= 0; i--) { for (int j = 0; j < split.length; j++) { if (wildcardMatch(tables.get(i), split[j])) { filterTables.remove(i); } } } } }