package com.backendsys.utils.response;

import com.github.pagehelper.PageInfo;

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

@SuppressWarnings({"rawtypes", "unchecked"})
public class PageInfoResult extends PageInfo {
    public PageInfoResult() {}
    public PageInfoResult(List list) {
        super(list);
    }
    public PageInfoResult(List list, int navigatePages) {
        super(list, navigatePages);
    }
    public Map<String, Object> toMap() {
        Map<String, Object> map = new LinkedHashMap<>();
        map.put("total", getTotal());
        map.put("page_num", getPageNum());
        map.put("page_size", getPageSize());
        map.put("list", getList());
        return map;
    }
    public PageEntity toEntity() {
        PageEntity entity = new PageEntity();
        entity.setTotal(getTotal());
        entity.setPage_num(getPageNum());
        entity.setPage_size(getPageSize());
        entity.setList(getList());
        return entity;
    }
}
