package org.ccpit.base.controller;

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

/**
 * Created by Administrator on 2015/8/13.
 */
public class PageBo <T>{
    private List<Map<String,Object>> rows = new ArrayList<Map<String, Object>>();
    private long total = 0L;
    private int pageNo;
    
	public PageBo() {}

	public PageBo(Page<T> page,Convert<T> convert) {
        setTotal(page.getTotal());
        setPageNo(page.getPageNo());
        List<Map<String,Object>> newRows = new ArrayList<Map<String, Object>>();
        for (T t:page.getRows()){
            newRows.add(convert.convert(t));
        }
        setRows(newRows);
    }

    public List<Map<String, Object>> getRows() {
        return rows;
    }

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

    public long getTotal() {
        return total;
    }

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

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }
}
