huanghongfa
2021-09-02 177249c76aeea0b4bf8d8816d4994e3b445b45ce
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/IPageVO.java
@@ -1,26 +1,19 @@
/*
 * 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.
 * 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.panzhihua.common.model.vos;
import static java.util.stream.Collectors.toList;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import static java.util.stream.Collectors.toList;
/**
 * 分页 Page 对象接口
@@ -35,7 +28,9 @@
     *
     * @return 排序信息
     */
    List<Object> orders(){return null;}
    List<Object> orders() {
        return null;
    }
    /**
     * KEY/VALUE 条件
@@ -44,7 +39,7 @@
     * @deprecated 3.4.0 @2020-06-30
     */
    @Deprecated
     Map<Object, Object> condition() {
    Map<Object, Object> condition() {
        return null;
    }
@@ -53,7 +48,7 @@
     *
     * @return true 是 / false 否
     */
     boolean optimizeCountSql() {
    boolean optimizeCountSql() {
        return true;
    }
@@ -62,14 +57,14 @@
     *
     * @return true 是 / false 否
     */
     boolean isSearchCount() {
    boolean isSearchCount() {
        return true;
    }
    /**
     * 计算当前分页偏移量
     */
     long offset() {
    long offset() {
        long current = getCurrent();
        if (current <= 1L) {
            return 0L;
@@ -82,14 +77,14 @@
     *
     * @since 3.4.0 @2020-07-17
     */
     Long maxLimit() {
    Long maxLimit() {
        return null;
    }
    /**
     * 当前分页总页数
     */
     long getPages() {
    long getPages() {
        if (getSize() == 0) {
            return 0L;
        }
@@ -102,9 +97,11 @@
    /**
     * 内部什么也不干
     * <p>只是为了 json 反序列化时不报错</p>
     * <p>
     * 只是为了 json 反序列化时不报错
     * </p>
     */
     IPageVO<T> setPages(long pages) {
    IPageVO<T> setPages(long pages) {
        // to do nothing
        return this;
    }
@@ -112,12 +109,13 @@
    /**
     * 设置是否命中count缓存
     *
     * @param hit 是否命中
     * @param hit
     *            是否命中
     * @since 3.3.1
     * @deprecated 3.4.0 @2020-06-30 缓存遵循mybatis的一或二缓
     */
    @Deprecated
     void hitCount(boolean hit) {
    void hitCount(boolean hit) {
    }
@@ -129,7 +127,7 @@
     * @deprecated 3.4.0 @2020-06-30 缓存遵循mybatis的一或二缓
     */
    @Deprecated
     boolean isHitCount() {
    boolean isHitCount() {
        return false;
    }
@@ -138,60 +136,78 @@
     *
     * @return 分页对象记录列表
     */
    List<T> getRecords(){return null;}
    List<T> getRecords() {
        return null;
    }
    /**
     * 设置分页记录列表
     */
    IPageVO<T> setRecords(List<T> records){return null;}
    IPageVO<T> setRecords(List<T> records) {
        return null;
    }
    /**
     * 当前满足条件总行数
     *
     * @return 总条数
     */
    long getTotal(){return 0l;}
    long getTotal() {
        return 0l;
    }
    /**
     * 设置当前满足条件总行数
     */
    IPageVO<T> setTotal(long total){return null;}
    IPageVO<T> setTotal(long total) {
        return null;
    }
    /**
     * 获取每页显示条数
     *
     * @return 每页显示条数
     */
    long getSize(){return 0;}
    long getSize() {
        return 0;
    }
    /**
     * 设置每页显示条数
     */
    IPageVO<T> setSize(long size){return null;}
    IPageVO<T> setSize(long size) {
        return null;
    }
    /**
     * 当前页
     *
     * @return 当前页
     */
    long getCurrent(){return 0l;}
    long getCurrent() {
        return 0l;
    }
    /**
     * 设置当前页
     */
    IPageVO<T> setCurrent(long current){return null;}
    IPageVO<T> setCurrent(long current) {
        return null;
    }
    /**
     * IPageVO 的泛型转换
     *
     * @param mapper 转换函数
     * @param <R>    转换后的泛型
     * @param mapper
     *            转换函数
     * @param <R>
     *            转换后的泛型
     * @return 转换泛型后的 IPageVO
     */
    @SuppressWarnings("unchecked")
     <R> IPageVO<R> convert(Function<? super T, ? extends R> mapper) {
    <R> IPageVO<R> convert(Function<? super T, ? extends R> mapper) {
        List<R> collect = this.getRecords().stream().map(mapper).collect(toList());
        return ((IPageVO<R>) this).setRecords(collect);
        return ((IPageVO<R>)this).setRecords(collect);
    }
    /**
@@ -202,9 +218,8 @@
     * @return id
     * @since 3.4.0 @2020-06-19
     */
     String countId() {
    String countId() {
        return null;
    }
}