package com.sckw.payment.model.vo.res;

import com.sckw.core.model.page.PageRes;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * 返回的分页数据中，有额外需要返回的参数
 */
@Getter
@Setter
public class ApPageRes<T> extends PageRes<T> {
    private String apMoney;
    private String usingApMoney;
    private String totalApMoney;

    public ApPageRes(int page, int pageSize, long size, int pages, List<T> list) {
        super(page, pageSize, size, pages, list);
        this.apMoney = "0.00";
        this.usingApMoney = "0.00";
        this.totalApMoney = "0.00";
    }

    public ApPageRes(int page, int pageSize, List<T> list) {
        this.page = page;
        this.pageSize = pageSize;
        this.size = list.size();
        this.pages = list.size() / pageSize + 1;
        this.list = list.stream().skip((long) (page - 1) * pageSize).limit(pageSize).toList();
    }

}
