package com.ruoyi.oa.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.oa.domain.OaProjectReport;
import com.ruoyi.oa.domain.bo.OaProjectReportBo;
import com.ruoyi.oa.domain.vo.OaProjectReportVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.oa.domain.vo.ProjectReportPieVo;
import com.ruoyi.oa.domain.vo.ProjectReportTrendVo;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * 项目报工Mapper接口
 *
 * @author hdka
 * @date 2025-06-16
 */
public interface OaProjectReportMapper extends BaseMapperPlus<OaProjectReportMapper, OaProjectReport, OaProjectReportVo> {
    List<OaProjectReportVo> selectAll(@Param("bo") OaProjectReportBo bo);
    Page<OaProjectReportVo> selectVoPagePlus(@Param("build") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<OaProjectReport> lqw);

    OaProjectReportVo selectVoByIdPlus(@Param("reportId") Long reportId);

    Long countWithPending(Date date);

    Long countWithCompleted(Date createTime);

    /**
     * 报工趋势：按天统计报工记录数
     */
    List<ProjectReportTrendVo> selectReportTrend(
            @Param("start")
            LocalDate start,
            @Param("end") LocalDate end
    );

    /**
     * 项目分布：各项目报工次数分布
     */
    List<ProjectReportPieVo> selectProjectDistribution(@Param("start") LocalDate start, @Param("end") LocalDate end);

    List<OaProjectReportVo> selectRankData(@Param("start") LocalDate start, @Param("end") LocalDate end);

    List<OaProjectReportVo> getProjects(@Param("start") LocalDate start, @Param("end") LocalDate end);

    List<OaProjectReportVo> getClearList(@Param("start") LocalDate start, @Param("end") LocalDate end);

    List<OaProjectReportVo> getSummaryData(@Param("start") LocalDate start, @Param("end") LocalDate end);
}
