From 402255ba0da5e6acb73e2ab85c9c829bfd4b6290 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Thu, 4 Jan 2018 20:02:51 +0800 Subject: [PATCH] =?UTF-8?q?Flipper=E7=9A=84limit=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/source/Flipper.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/org/redkale/source/Flipper.java b/src/org/redkale/source/Flipper.java index 829075335..d8a42d7c7 100644 --- a/src/org/redkale/source/Flipper.java +++ b/src/org/redkale/source/Flipper.java @@ -33,7 +33,7 @@ public final class Flipper implements Serializable, Cloneable { } public Flipper(int limit) { - this.limit = limit > 0 ? limit : DEFAULT_LIMIT; + this.limit = limit > 0 ? limit : 0; } public Flipper(String sortColumn) { @@ -41,17 +41,17 @@ public final class Flipper implements Serializable, Cloneable { } public Flipper(int limit, int offset) { - this.limit = limit > 0 ? limit : DEFAULT_LIMIT; + this.limit = limit > 0 ? limit : 0; this.offset = offset < 0 ? 0 : offset; } public Flipper(int limit, String sortColumn) { - this.limit = limit > 0 ? limit : DEFAULT_LIMIT; + this.limit = limit > 0 ? limit : 0; this.sort = sortColumn; } public Flipper(int limit, int offset, String sortColumn) { - this.limit = limit > 0 ? limit : DEFAULT_LIMIT; + this.limit = limit > 0 ? limit : 0; this.offset = offset < 0 ? 0 : offset; this.sort = sortColumn; } @@ -93,9 +93,7 @@ public final class Flipper implements Serializable, Cloneable { } public void setLimit(int limit) { - if (limit > 0) { - this.limit = limit; - } + this.limit = limit; } public Flipper limit(int limit) { @@ -121,9 +119,7 @@ public final class Flipper implements Serializable, Cloneable { } public void setSort(String sort) { - if (sort != null) { - this.sort = sort.trim(); - } + this.sort = sort == null ? "" : sort.trim(); } public Flipper sort(String sort) {