package cn.com.ty.lift.push.message.object;

import cn.com.ty.lift.common.model.TimeMessage;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class MessageBO extends Page<TimeMessage> implements IPage<TimeMessage> {
    private Long readCount;
    private Long unreadCount;

    public static MessageBO pageCastMessageBo(IPage<TimeMessage> page) {
        MessageBO messageBO = new MessageBO();
        messageBO.setRecords(page.getRecords());
        messageBO.setCurrent(page.getCurrent());
        messageBO.setPages(page.getPages());
        messageBO.setSize(page.getSize());
        messageBO.setTotal(page.getTotal());
        return messageBO;
    }
}
