From 402953e317161635a7f16b4797cc95fcd3268eef Mon Sep 17 00:00:00 2001 From: VampireAchao Date: Tue, 20 Feb 2024 19:16:38 +0800 Subject: [PATCH] [improve] invert if predicate --- .../handler/JsonPostInitTableInfoHandler.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/stream-plugin/stream-plugin-mybatis-plus/src/main/java/org/dromara/streamquery/stream/plugin/mybatisplus/engine/handler/JsonPostInitTableInfoHandler.java b/stream-plugin/stream-plugin-mybatis-plus/src/main/java/org/dromara/streamquery/stream/plugin/mybatisplus/engine/handler/JsonPostInitTableInfoHandler.java index f5cb35fda..8c8bfa2d4 100644 --- a/stream-plugin/stream-plugin-mybatis-plus/src/main/java/org/dromara/streamquery/stream/plugin/mybatisplus/engine/handler/JsonPostInitTableInfoHandler.java +++ b/stream-plugin/stream-plugin-mybatis-plus/src/main/java/org/dromara/streamquery/stream/plugin/mybatisplus/engine/handler/JsonPostInitTableInfoHandler.java @@ -30,6 +30,7 @@ import java.lang.annotation.Annotation; import java.util.Map; +import java.util.Objects; /** * @author VampireAchao @@ -70,13 +71,14 @@ public void postTableInfo(TableInfo tableInfo, Configuration configuration) { } ResultMap resultMap = configuration.getResultMap(tableInfo.getResultMap()); for (ResultMapping resultMapping : resultMap.getResultMappings()) { - if (resultMapping.getProperty().equalsIgnoreCase(fieldInfo.getProperty())) { - TypeHandler handler = resultMapping.getTypeHandler(); - if (handler instanceof AbstractJsonFieldHandler) { - AbstractJsonFieldHandler typeHandler = (AbstractJsonFieldHandler) handler; - typeHandler.setTableInfo(tableInfo); - typeHandler.setFieldInfo(fieldInfo); - } + if (!Objects.equals(resultMapping.getProperty(), fieldInfo.getProperty())) { + continue; + } + TypeHandler handler = resultMapping.getTypeHandler(); + if (handler instanceof AbstractJsonFieldHandler) { + AbstractJsonFieldHandler typeHandler = (AbstractJsonFieldHandler) handler; + typeHandler.setTableInfo(tableInfo); + typeHandler.setFieldInfo(fieldInfo); } } }