reghao 2 лет назад
Родитель
Сommit
8e83422549

+ 0 - 4
jdk/src/main/java/cn/reghao/jutil/jdk/db/BaseQuery.java

@@ -11,10 +11,6 @@ public interface BaseQuery<T> {
     default int count() {
         return 0;
     }
-
-    default PageList<T> findAllByPage(int page, int size) {
-        return PageList.empty(page, size);
-    }
     default List<T> findAll() {
         return Collections.emptyList();
     }

+ 7 - 30
jdk/src/main/java/cn/reghao/jutil/jdk/db/PageList.java

@@ -23,18 +23,13 @@ public class PageList<T> {
     // 当前页元素
     private final List<T> list;
 
-    // 当前页
-    @Deprecated
-    private int page;
-    // 当前页大小
-    @Deprecated
-    private int size;
-    // 根据当前页大小计算得出的总页数
-    @Deprecated
-    private int pages;
-    // 总数量
-    @Deprecated
-    private int total;
+    public static <T> PageList<T> empty() {
+        return new PageList<>(1, 10, 0, Collections.emptyList());
+    }
+
+    public static <T> PageList<T> pageList(int pageNumber, int pageSize, int total, List<T> list) {
+        return new PageList<>(pageNumber, pageSize, total, list);
+    }
 
     private PageList(int pageNumber, int pageSize, int totalSize, List<T> list) {
         this.pageNumber = pageNumber;
@@ -77,22 +72,4 @@ public class PageList<T> {
     public List<T> getList() {
         return list;
     }
-
-    @Deprecated
-    public static <T> PageList<T> empty(int pageNumber, int pageSize) {
-        return new PageList<>(pageNumber, pageSize);
-    }
-
-    public static <T> PageList<T> empty() {
-        return new PageList<>(1, 10, 0, Collections.emptyList());
-    }
-
-    @Deprecated
-    public static <T> PageList<T> pageList(List<T> list) {
-        return new PageList<>(1, 10, 0, Collections.emptyList());
-    }
-
-    public static <T> PageList<T> pageList(int pageNumber, int pageSize, int total, List<T> list) {
-        return new PageList<>(pageNumber, pageSize, total, list);
-    }
 }

+ 0 - 37
jdk/src/main/java/cn/reghao/jutil/jdk/db/Pager.java

@@ -1,37 +0,0 @@
-package cn.reghao.jutil.jdk.db;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2022-05-31 16:23:04
- */
-@Deprecated
-public class Pager<T> implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private long total;
-    private int pageSize;
-    private long totalPages;
-    private int currentPage;
-    private List<T> list;
-    private boolean hasNext;
-
-    private Pager(long total, int pageSize, long totalPages, int currentPage, List<T> list, boolean hasNext) {
-        this.total = total;
-        this.pageSize = pageSize;
-        this.totalPages = totalPages;
-        this.currentPage = currentPage;
-        this.list = list;
-        this.hasNext = hasNext;
-    }
-
-    public static <T> Pager<T> pageList(long total, int pageSize, int currentPage, List<T> list) {
-        long pages = total/pageSize;
-        int mod = (int)total%pageSize;
-        long totalPages = (mod == 0 ? pages : pages+1);
-        boolean hasNext = total - ((long) pageSize *currentPage) > 0;
-        return new Pager<>(total, pageSize, totalPages, currentPage, list, hasNext);
-    }
-}