File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
mapper/src/main/java/io/mybatis/mapper/fn Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 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>
You can’t perform that action at this time.
0 commit comments