diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/KeywordWrap.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/KeywordWrap.java index b2d984c3..8096a6ac 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/KeywordWrap.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/KeywordWrap.java @@ -20,6 +20,7 @@ import com.mybatisflex.core.util.StringUtil; import java.util.Collections; import java.util.Set; +import java.util.stream.Collectors; /** * 用于对数据库的关键字包装 @@ -97,16 +98,15 @@ public class KeywordWrap { public KeywordWrap(boolean caseSensitive, Set keywords, String prefix, String suffix) { this.caseSensitive = caseSensitive; - this.keywords = keywords; + this.keywords = keywords.stream().map(String::toUpperCase).collect(Collectors.toSet()); this.prefix = prefix; this.suffix = suffix; } - public KeywordWrap(boolean caseSensitive, boolean keywordsToUpperCase, Set keywords, String prefix, - String suffix) { + public KeywordWrap(boolean caseSensitive, boolean keywordsToUpperCase, Set keywords, String prefix, String suffix) { this.caseSensitive = caseSensitive; this.keywordsToUpperCase = keywordsToUpperCase; - this.keywords = keywords; + this.keywords = keywords.stream().map(String::toUpperCase).collect(Collectors.toSet()); this.prefix = prefix; this.suffix = suffix; } @@ -120,8 +120,12 @@ public class KeywordWrap { return prefix + keyword + suffix; } - keyword = keywordsToUpperCase ? keyword.toUpperCase() : keyword; - return keywords.contains(keyword) ? (prefix + keyword + suffix) : keyword; + if (keywordsToUpperCase) { + keyword = keyword.toUpperCase(); + return keywords.contains(keyword) ? (prefix + keyword + suffix) : keyword; + } else { + return keywords.contains(keyword.toUpperCase()) ? (prefix + keyword + suffix) : keyword; + } } public boolean isCaseSensitive() { diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/DmDialect.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/DmDialect.java index 7321b0df..06728ab9 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/DmDialect.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/dialect/impl/DmDialect.java @@ -69,7 +69,6 @@ public class DmDialect extends CommonsDialectImpl { "SQL", "WHERE", "MIN", "PROCEDURE", "SQLCODE", "WHILE", "MINUS", "PUBLIC", "SQLERRM", "WITH", "MLSLABEL", "RAISE", "START", "WORK", "MOD", "RANGE", "STATEMENT", "XOR", "MODE", "REAL", "STDDEV", "NATURAL", "RECORD", "SUBTYPE", "GEN", "KP", "L", "NA", "NC", "ND", "NL", "NM", "NR", "NS", "NT", "NZ", "TTC", "UPI", "O", "S", "XA" - ); public DmDialect() {