package com.simuwang.base.common.support.query;

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

import java.util.List;

/**
 * @author wangzaijun
 * @date 2024/9/13 13:48
 * @description 分页请求的参数
 */
public class PageQuery extends BaseQuery {
    /**
     * 当前页
     */
    private Long current;
    /**
     * 每页数
     */
    private Long pageSize;
    /**
     * 当前页记录开始
     */
    private Long offset;
    /**
     * 排序字段
     */
    private List<OrderItem> orderItems;

    public PageQuery() {
        this.current = 1L;
        this.pageSize = 10L;
    }

    public Long getCurrent() {
        return current;
    }

    public void setCurrent(Long current) {
        this.current = current;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        this.pageSize = pageSize;
    }

    public List<OrderItem> getOrderItems() {
        return orderItems;
    }

    public void setOrderItems(List<OrderItem> orderItems) {
        this.orderItems = orderItems;
    }

    public Long getOffset() {
        return (current - 1) * pageSize;
    }
}
