From b78e07465f8d100a6e26bf14ff96373a3a5e5358 Mon Sep 17 00:00:00 2001 From: Lyp Date: Tue, 25 Jun 2024 21:17:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=A3=E5=86=B3typeHandler=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E5=8C=96=E5=8F=82=E6=95=B0=E6=97=A0=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E9=97=AE=E9=A2=98=20close=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/mybatis/mapper/example/Example.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/mapper/src/main/java/io/mybatis/mapper/example/Example.java b/mapper/src/main/java/io/mybatis/mapper/example/Example.java index c7b28ea..c945086 100644 --- a/mapper/src/main/java/io/mybatis/mapper/example/Example.java +++ b/mapper/src/main/java/io/mybatis/mapper/example/Example.java @@ -1359,8 +1359,15 @@ protected Criterion(String condition, Object value, EntityColumn column) { super(); this.condition = condition; this.value = value; - this.javaType = value != null ? column.javaType().getName() : null; - this.typeHandler = typeHandler != null ? column.typeHandler().getName() : null; + if (column != null) { + Class javaTypeClass = column.javaType(); + if (javaTypeClass != null) { + this.javaType = javaTypeClass.getName(); + } + if (column.typeHandler() != null) { + this.typeHandler = column.typeHandler().getName(); + } + } if (value instanceof Collection) { if (condition != null) { this.listValue = true; @@ -1377,8 +1384,15 @@ protected Criterion(String condition, Object value, Object secondValue, EntityCo this.condition = condition; this.value = value; this.secondValue = secondValue; - this.javaType = value != null ? column.javaType().getName() : null; - this.typeHandler = typeHandler != null ? column.typeHandler().getName() : null; + if (column != null) { + Class javaTypeClass = column.javaType(); + if (javaTypeClass != null) { + this.javaType = javaTypeClass.getName(); + } + if (column.typeHandler() != null) { + this.typeHandler = column.typeHandler().getName(); + } + } this.betweenValue = true; }