xiejun
2025-01-23 9ac3bd680a350c1cc4baad082d92cd2c5f158f3e
Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/object/IPage.java
@@ -1,49 +1,48 @@
package com.vci.rmip.code.client.codeapply.Apply410.object;
import java.io.Serializable;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
public interface IPage<T> extends Serializable {
   List<OrderItem> orders();
   default boolean optimizeCountSql() {
      return true;
   }
//   default boolean optimizeCountSql() {
//      return true;
//   }
   default boolean optimizeJoinOfCountSql() {
      return true;
   }
//   default boolean optimizeJoinOfCountSql() {
//      return true;
//   }
//
//   default boolean searchCount() {
//      return true;
//   }
//
//   default long offset() {
//      long current = this.getCurrent();
//      return current <= 1L ? 0L : Math.max((current - 1L) * this.getSize(), 0L);
//   }
   default boolean searchCount() {
      return true;
   }
//   default Long maxLimit() {
//      return null;
//   }
//
//   default long getPages() {
//      if (this.getSize() == 0L) {
//         return 0L;
//      } else {
//         long pages = this.getTotal() / this.getSize();
//         if (this.getTotal() % this.getSize() != 0L) {
//            ++pages;
//         }
//
//         return pages;
//      }
//   }
   default long offset() {
      long current = this.getCurrent();
      return current <= 1L ? 0L : Math.max((current - 1L) * this.getSize(), 0L);
   }
   default Long maxLimit() {
      return null;
   }
   default long getPages() {
      if (this.getSize() == 0L) {
         return 0L;
      } else {
         long pages = this.getTotal() / this.getSize();
         if (this.getTotal() % this.getSize() != 0L) {
            ++pages;
         }
         return pages;
      }
   }
   default IPage<T> setPages(long pages) {
      return this;
   }
//   default IPage<T> setPages(long pages) {
//      return this;
//   }
   List<T> getRecords();
@@ -61,11 +60,11 @@
   IPage<T> setCurrent(long current);
   default <R> IPage<T> convert(Function<? super T, ? extends R> mapper) {
      List<T> collect = (List)this.getRecords().stream().map(mapper).collect(Collectors.toList());
      return this.setRecords(collect);
   }
   default String countId() {
      return null;
   }
//   default <R> IPage<T> convert(Function<? super T, ? extends R> mapper) {
//      List<T> collect = (List)this.getRecords().stream().map(mapper).collect(Collectors.toList());
//      return this.setRecords(collect);
//   }
//   default String countId() {
//      return null;
//   }
}