All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.mybatisplus.model.MyBatisPlusPage Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.mybatisplus.model;

import com.baomidou.mybatisplus.core.metadata.IPage;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

public class MyBatisPlusPage implements Serializable {

    private static final long serialVersionUID = -21458386450049848L;

    /*查询数据列表。*/
    private List records = Collections.emptyList();

    /*总数。*/
    private long total = 0;

    /*每页显示条数,默认 10。*/
    private long size = 10;

    /*当前页。*/
    private long current = 1;

    private MyBatisPlusPage() {
        super();
    }

    public List getRecords() {
        return records;
    }

    public MyBatisPlusPage setRecords(List records) {
        this.records = records;
        return this;
    }

    public long getTotal() {
        return total;
    }

    public MyBatisPlusPage setTotal(long total) {
        this.total = total;
        return this;
    }

    public long getSize() {
        return size;
    }

    public MyBatisPlusPage setSize(long size) {
        this.size = size;
        return this;
    }

    public long getCurrent() {
        return current;
    }

    public MyBatisPlusPage setCurrent(long current) {
        this.current = current;
        return this;
    }

    /**
     * {@code MyBatis-Plus}分页模型转化。
     *
     * @param  数据类型
     * @param page 分页实体类
     * @return {@code MyBatisPlusPage}
     */
    public static  MyBatisPlusPage of(IPage page) {
        MyBatisPlusPage myBatisPlusPage = new MyBatisPlusPage<>();
        myBatisPlusPage.setRecords(page.getRecords())
        .setTotal(page.getTotal())
        .setSize(page.getSize())
        .setCurrent(page.getCurrent());
        return myBatisPlusPage;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy