package com.bonus.sharedstation.common.pojo;

import java.util.List;
import java.util.Map;

public class PageDTO<T> {
	
	//每页数量
	private Integer limit = 10;
	//每页第几個開始
	private Integer offset;
	//当前页数（前端传的当前页）
	private Integer currentPage;
		
	//查询的request对象（前端传的参数）
	private T queryObj;
	
	
	//start 与 end 是id优化条件，你选择是否用或者不用,仅限于ID连续自增的查询
	private Integer start;
	
	private Integer end;
	
	//总条数(第一次、第一页返回)
	private Integer total;
	//返回的response  list对象
	private List<Map<String,Object>> data;
	
    private String StartTime;
	
	private String EndtTime;
	

	

	public String getStartTime() {
		return StartTime;
	}

	public void setStartTime(String startTime) {
		StartTime = startTime;
	}

	public String getEndtTime() {
		return EndtTime;
	}

	public void setEndtTime(String endtTime) {
		EndtTime = endtTime;
	}

	public Integer getLimit() {
		return limit;
	}

	public void setLimit(Integer limit) {
		this.limit = limit;
	}

	public Integer getOffset() {
        if (currentPage != null && currentPage >= 1) {
            return (currentPage - 1)*limit;
        } else {
            return 0;
        }
	}

	public void setOffset(Integer offset) {
		this.offset = offset;
	}



	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public Integer getStart() {
		
        if (currentPage != null && currentPage >= 1) {
            return (currentPage - 1)*limit;
        } else {
            return 0;
        }
	}

	public void setStart(Integer start) {
		this.start = start;
	}

	public Integer getEnd() {
		
        if (currentPage != null && currentPage >= 1) {
            return (currentPage - 1)*limit + limit;
        } else {
            return limit;
        }
		
	}

	public void setEnd(Integer end) {
		this.end = end;
	}




	public List<Map<String, Object>> getData() {
		return data;
	}

	public void setData(List<Map<String, Object>> data) {
		this.data = data;
	}

	public T getQueryObj() {
		return queryObj;
	}

	public void setQueryObj(T queryObj) {
		this.queryObj = queryObj;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	@Override
	public String toString() {
		return "PageDTO [limit=" + limit + ", offset=" + offset + ", currentPage=" + currentPage + ", queryObj="
				+ queryObj + ", start=" + start + ", end=" + end + ", total=" + total + ", data=" + data + "]";
	}





	
	

}
