Преглед изворни кода

[修复] 解决数据库字段与实体字段名称不同时出现`null as xxx`的情况

Caratacus пре 5 година
родитељ
комит
9887c46d06

+ 3 - 3
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableFieldInfo.java

@@ -188,10 +188,10 @@ public class TableFieldInfo implements Constants {
         if (StringUtils.isNotBlank(columnFormat) && tableField.keepGlobalFormat()) {
             column = String.format(columnFormat, column);
         }
+
         this.column = column;
-        if (!TableInfoHelper.checkRelated(tableInfo.isUnderCamel(), this.property, this.column)) {
-            this.sqlSelect = column;
-        } else {
+        this.sqlSelect = column;
+        if (TableInfoHelper.checkRelated(tableInfo.isUnderCamel(), this.property, this.column)) {
             String propertyFormat = dbConfig.getPropertyFormat();
             String asProperty = this.property;
             if (StringUtils.isNotBlank(propertyFormat)) {