Skip to content

Commit

Permalink
[improve] invert if predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
VampireAchao committed Feb 20, 2024
1 parent bdcdb31 commit 402953e
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Objects;

/**
* @author VampireAchao
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 402953e

Please sign in to comment.