package com.ruoyi.common.core.page;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.core.domain.BaseEntity;

import lombok.Data;

@Data
public class MyEntryPage extends BaseEntity {
	
	/** 当前记录起始索引 */
	@TableField(exist = false)
	private Integer pageNum;
	
	@TableField(exist = false)
	private Integer offset;
	
	
	/** 每页显示记录数 */
	@TableField(exist = false)
	private Integer pageSize;
	

	@TableField(exist = false)
	private Integer total;
	
	public MyEntryPage(Integer pageNum,Integer pageSize) {
		this.pageNum=pageNum;
		this.pageSize=pageSize;
		this.offset=getOffset();
	}
	
	public MyEntryPage() {
	}

	
	
	
	private Integer getOffset() {
		if (pageNum <= 1) {
			return 0;
		}

		int offset = (pageNum - 1) * pageSize + 1;

		return offset;

	}

}
