Skip to content

Commit 865b4a5

Browse files
committed
Merge branch 'develop'
# Conflicts: # pom.xml
2 parents c7c35e7 + e0ff485 commit 865b4a5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

mapper/src/main/java/io/mybatis/mapper/fn/Fn.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ default String toColumn() {
9292
default Reflections.ClassField toClassField() {
9393
if (!FN_CLASS_FIELD_MAP.containsKey(this)) {
9494
synchronized (this) {
95-
if(!FN_CLASS_FIELD_MAP.containsKey(this)) {
95+
if (!FN_CLASS_FIELD_MAP.containsKey(this)) {
9696
FN_CLASS_FIELD_MAP.put(this, Reflections.fnToFieldName(this));
9797
}
9898
}
@@ -110,10 +110,14 @@ default EntityColumn toEntityColumn() {
110110
synchronized (this) {
111111
if (!FN_COLUMN_MAP.containsKey(this)) {
112112
Reflections.ClassField classField = toClassField();
113-
EntityColumn entityColumn = EntityFactory.create(classField.getClazz()).columns().stream()
114-
.filter(column -> column.property().equals(classField.getField())).findFirst()
115-
.orElseThrow(() -> new RuntimeException(classField.getField()
116-
+ " does not mark database column field annotations, unable to obtain column information"));
113+
List<EntityColumn> columns = EntityFactory.create(classField.getClazz()).columns();
114+
EntityColumn entityColumn = columns.stream()
115+
// 先区分大小写匹配字段
116+
.filter(column -> column.property().equals(classField.getField())).findFirst()
117+
// 如果不存在,再忽略大小写进行匹配
118+
.orElseGet(() -> columns.stream().filter(column -> column.property().equalsIgnoreCase(classField.getField()))
119+
.findFirst().orElseThrow(() -> new RuntimeException(classField.getField()
120+
+ " does not mark database column field annotations, unable to obtain column information")));
117121
FN_COLUMN_MAP.put(this, entityColumn);
118122
}
119123
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</modules>
6060

6161
<properties>
62-
<revision>1.2.1</revision>
62+
<revision>1.2.2</revision>
6363
<maven.compiler.source>8</maven.compiler.source>
6464
<maven.compiler.target>8</maven.compiler.target>
6565
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

0 commit comments

Comments
 (0)