package com.jwipc.sys.logic.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.page.PageUtil;
import com.jwipc.page.PageView;
import com.jwipc.sys.entity.EmailLog;
import com.jwipc.sys.logic.EmailLogLogic;
import com.jwipc.sys.model.po.EmailLogPO;
import com.jwipc.sys.model.query.EmailLogQuery;
import com.jwipc.sys.service.IEmailLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shenyang.ou
 * @date 2024/1/30 9:27
 * @desc 邮件日志
 */
@Service
@RequiredArgsConstructor
public class EmailLogLogicImpl implements EmailLogLogic {

    private final IEmailLogService emailLogService;

    @Override
    public PageView findByPage(EmailLogQuery query) {
        final Page<EmailLog> dbPage = PageUtil.toPage(query);
        List<EmailLogPO> emailLogs = emailLogService.findPageByQuery(dbPage, query);
        return PageUtil.getPV(emailLogs, dbPage.getTotal());
    }
}
