瀏覽代碼

修复主键 @OrderBy 注解 bug

hubin 3 年之前
父節點
當前提交
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
     private List<TableFieldInfo> orderByFields;
 
@@ -485,10 +484,7 @@ public class TableInfo implements Constants {
                 this.withUpdateFill = true;
             }
             if (i.isOrderBy()) {
-                if (null == this.orderByFields) {
-                    this.orderByFields = new LinkedList<>();
-                }
-                this.orderByFields.add(i);
+                this.getOrderByFields().add(i);
             }
             if (i.isVersion()) {
                 this.withVersion = true;
@@ -505,6 +501,13 @@ public class TableInfo implements Constants {
         return Collections.unmodifiableList(fieldList);
     }
 
+    public List<TableFieldInfo> getOrderByFields() {
+        if (null == this.orderByFields) {
+            this.orderByFields = new LinkedList<>();
+        }
+        return this.orderByFields;
+    }
+
     @Deprecated
     public boolean isLogicDelete() {
         return withLogicDelete;