Skip to content

Commit 7c231c9

Browse files
L1ypabel533
authored andcommitted
feat: 解决typeHandler实例化参数无实际类型的问题 close #113
1 parent fe014cd commit 7c231c9

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

mapper/src/main/java/io/mybatis/mapper/example/Example.java

+18-4
Original file line numberDiff line numberDiff line change
@@ -1359,8 +1359,15 @@ protected Criterion(String condition, Object value, EntityColumn column) {
13591359
super();
13601360
this.condition = condition;
13611361
this.value = value;
1362-
this.javaType = value != null ? column.javaType().getName() : null;
1363-
this.typeHandler = typeHandler != null ? column.typeHandler().getName() : null;
1362+
if (column != null) {
1363+
Class<?> javaTypeClass = column.javaType();
1364+
if (javaTypeClass != null) {
1365+
this.javaType = javaTypeClass.getName();
1366+
}
1367+
if (column.typeHandler() != null) {
1368+
this.typeHandler = column.typeHandler().getName();
1369+
}
1370+
}
13641371
if (value instanceof Collection<?>) {
13651372
if (condition != null) {
13661373
this.listValue = true;
@@ -1377,8 +1384,15 @@ protected Criterion(String condition, Object value, Object secondValue, EntityCo
13771384
this.condition = condition;
13781385
this.value = value;
13791386
this.secondValue = secondValue;
1380-
this.javaType = value != null ? column.javaType().getName() : null;
1381-
this.typeHandler = typeHandler != null ? column.typeHandler().getName() : null;
1387+
if (column != null) {
1388+
Class<?> javaTypeClass = column.javaType();
1389+
if (javaTypeClass != null) {
1390+
this.javaType = javaTypeClass.getName();
1391+
}
1392+
if (column.typeHandler() != null) {
1393+
this.typeHandler = column.typeHandler().getName();
1394+
}
1395+
}
13821396
this.betweenValue = true;
13831397
}
13841398

0 commit comments

Comments
 (0)