Browse Source

修复主键 @OrderBy 注解 bug

hubin 3 years ago
parent
commit
c463e0fdeb

+ 8 - 5
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableInfo.java

@@ -172,7 +172,6 @@ public class TableInfo implements Constants {
     /**
     /**
      * 排序列表
      * 排序列表
      */
      */
-    @Getter
     @Setter
     @Setter
     private List<TableFieldInfo> orderByFields;
     private List<TableFieldInfo> orderByFields;
 
 
@@ -485,10 +484,7 @@ public class TableInfo implements Constants {
                 this.withUpdateFill = true;
                 this.withUpdateFill = true;
             }
             }
             if (i.isOrderBy()) {
             if (i.isOrderBy()) {
-                if (null == this.orderByFields) {
-                    this.orderByFields = new LinkedList<>();
-                }
-                this.orderByFields.add(i);
+                this.getOrderByFields().add(i);
             }
             }
             if (i.isVersion()) {
             if (i.isVersion()) {
                 this.withVersion = true;
                 this.withVersion = true;
@@ -505,6 +501,13 @@ public class TableInfo implements Constants {
         return Collections.unmodifiableList(fieldList);
         return Collections.unmodifiableList(fieldList);
     }
     }
 
 
+    public List<TableFieldInfo> getOrderByFields() {
+        if (null == this.orderByFields) {
+            this.orderByFields = new LinkedList<>();
+        }
+        return this.orderByFields;
+    }
+
     @Deprecated
     @Deprecated
     public boolean isLogicDelete() {
     public boolean isLogicDelete() {
         return withLogicDelete;
         return withLogicDelete;