|
@@ -1,8 +1,23 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
|
|
|
+ * <p>
|
|
|
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
+ * use this file except in compliance with the License. You may obtain a copy of
|
|
|
+ * the License at
|
|
|
+ * <p>
|
|
|
+ * https://www.apache.org/licenses/LICENSE-2.0
|
|
|
+ * <p>
|
|
|
+ * Unless required by applicable law or agreed to in writing, software
|
|
|
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
+ * License for the specific language governing permissions and limitations under
|
|
|
+ * the License.
|
|
|
+ */
|
|
|
package com.baomidou.mybatisplus.core.metadata;
|
|
|
|
|
|
-import lombok.Getter;
|
|
|
-import lombok.Setter;
|
|
|
+import lombok.Data;
|
|
|
import lombok.ToString;
|
|
|
+import lombok.experimental.Accessors;
|
|
|
|
|
|
/**
|
|
|
* 排序元素载体
|
|
@@ -10,11 +25,10 @@ import lombok.ToString;
|
|
|
* @author HCL
|
|
|
* Create at 2019/5/27
|
|
|
*/
|
|
|
-@Getter
|
|
|
-@Setter
|
|
|
+@Data
|
|
|
+@Accessors(chain = true)
|
|
|
@ToString
|
|
|
public class OrderItem {
|
|
|
-
|
|
|
/**
|
|
|
* 需要进行排序的字段
|
|
|
*/
|
|
@@ -29,7 +43,11 @@ public class OrderItem {
|
|
|
return build(column, true);
|
|
|
}
|
|
|
|
|
|
- public static OrderItem build(String column, boolean asc) {
|
|
|
+ public static OrderItem desc(String column) {
|
|
|
+ return build(column, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static OrderItem build(String column, boolean asc) {
|
|
|
OrderItem item = new OrderItem();
|
|
|
item.setColumn(column);
|
|
|
item.setAsc(asc);
|