package org.agt.module.license.service.report;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.agt.framework.common.pojo.PageResult;
import org.agt.module.license.controller.admin.report.vo.ReportLicensePageReqVO;
import org.agt.module.license.controller.admin.report.vo.ReportLicenseRespVO;
import org.agt.module.license.controller.admin.report.vo.ReportProgressProjectReqVO;
import org.agt.module.license.controller.admin.report.vo.ReportProgressProjectRespVO;
import org.agt.module.license.dal.mysql.report.ReportMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * 报表 Service 实现类
 *
 * @author 管理员
 */
@Service
@Validated
public class ReportServiceImpl implements ReportService {

    @Resource
    private ReportMapper reportMapper;

    @Override
    public PageResult<ReportProgressProjectRespVO> getCommentByProject(ReportProgressProjectReqVO pageReqVO) {
        IPage<ReportProgressProjectRespVO> page = reportMapper.getCommentByProject(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);

        return new PageResult<>(page.getRecords(), page.getTotal());
    }

    @Override
    public PageResult<ReportProgressProjectRespVO> getCommentByStaff(ReportProgressProjectReqVO pageReqVO) {
        IPage<ReportProgressProjectRespVO> page = reportMapper.getCommentByStaff(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);

        return new PageResult<>(page.getRecords(), page.getTotal());
    }

    @Override
    public PageResult<ReportLicenseRespVO> getExpiryLicense(ReportLicensePageReqVO pageReqVO) {
        IPage<ReportLicenseRespVO> page = reportMapper.getExpiryLicense(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);

        return new PageResult<>(page.getRecords(), page.getTotal());
    }

}