package com.hotwj.platform.reportStatistics.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hotwj.platform.reportStatistics.domain.bo.ReportLedgerQueryBo;
import com.hotwj.platform.reportStatistics.domain.vo.*;
import com.hotwj.platform.reportStatistics.domain.vo.security.PreJobTrainingDetail;
import com.hotwj.platform.reportStatistics.domain.vo.security.StudyRecordCourseVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 驾驶员台账Mapper接口
 *
 * @author shihongwei
 * @date 2026-01-06
 */
@Mapper
public interface LedgerReportMapper {
    /**
     * 查询学员的课程学习记录
     */
    List<StudyRecordCourseVo> selectStudyRecordCourses(@Param("companyId") Long companyId, @Param("trainingId") Long trainingId, @Param("userId") String userId);

    List<DriverInfoLedgerVo> selectDriverInfoPage(Page<DriverInfoLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<DriverInfoLedgerVo> selectDriverInfoList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<DriverHealthLedgerVo> selectDriverHealthPage(Page<DriverHealthLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<DriverHealthLedgerVo> selectDriverHealthList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<ProfCertScoreLedgerVo> selectProfCertScorePage(Page<ProfCertScoreLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<ProfCertScoreLedgerVo> selectProfCertScoreList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<DriverIntegrityLedgerVo> selectDriverIntegrityPage(Page<DriverIntegrityLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<DriverIntegrityLedgerVo> selectDriverIntegrityList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<VehicleInfoLedgerVo> selectVehicleInfoPage(Page<VehicleInfoLedgerVo> page, @Param("bo") ReportLedgerQueryBo bo);

    List<VehicleInfoLedgerVo> selectVehicleInfoList(@Param("bo") ReportLedgerQueryBo bo);

    List<GovVehicleInfoLedgerVo> selectGovVehicleInfoPage(Page<GovVehicleInfoLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<GovVehicleInfoLedgerVo> selectGovVehicleInfoList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<GovGpsViolationLedgerVo> selectGovGpsViolationPage(Page<GovGpsViolationLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<AccidentLedgerVo> selectAccidentPage(Page<AccidentLedgerVo> page, @Param("bo") ReportLedgerQueryBo bo);

    List<AccidentLedgerVo> selectAccidentList(@Param("bo") ReportLedgerQueryBo bo);

    List<GovAccidentLedgerVo> selectGovAccidentPage(Page<GovAccidentLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<GovAccidentLedgerVo> selectGovAccidentList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<PreJobTrainingLedgerVo> selectPreJobTrainingPage(Page<PreJobTrainingLedgerVo> page, @Param("bo") ReportLedgerQueryBo bo);

    List<PreJobTrainingLedgerVo> selectPreJobTrainingList(@Param("bo") ReportLedgerQueryBo bo);

    List<GovPreJobTrainingLedgerVo> selectGovPreJobTrainingPage(Page<GovPreJobTrainingLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<GovPreJobTrainingLedgerVo> selectGovPreJobTrainingList(@Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<GovPreJobTrainingDetailVo> selectGovPreJobTrainingDetailPage(Page<GovPreJobTrainingDetailVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<GovSafetyEducationTrainingVo> selectGovSafetyEducationTrainingPage(Page<GovSafetyEducationTrainingVo> page, @Param("bo") ReportLedgerQueryBo bo);

    /**
     * 查询安全生产教育培训详情（主信息）
     */
    GovSafetyEducationTrainingDetailVo selectGovSafetyEducationTrainingDetail(@Param("id") Long id);

    /**
     * 查询安全生产教育培训参训人员列表
     */
    List<GovSafetyEducationTrainingParticipantVo> selectGovSafetyEducationTrainingParticipants(@Param("trainingId") Long trainingId);

    /**
     * 查询安全生产教育培训内容列表（课程名称）
     */
    List<String> selectGovSafetyEducationTrainingCourseNames(@Param("trainingId") Long trainingId);

    /**
     * 统计指定时间段内的违章数量（按月分组）
     *
     * @param bo 查询条件
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @return 统计结果
     */
    List<GovViolationInfoLedgerVo> selectViolationCountByDateRange(@Param("bo") ReportLedgerQueryBo bo, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<GovViolationInfoDetailVo> selectGovViolationInfoDetailPage(Page<GovViolationInfoDetailVo> page, @Param("bo") ReportLedgerQueryBo bo);

    List<GovViolationHandlingLedgerVo> selectGovViolationHandlingPage(Page<GovViolationHandlingLedgerVo> page, @Param("districtCode") String districtCode, @Param("bo") ReportLedgerQueryBo bo);

    List<SafetyProductionMeetingLedgerVo> selectSafetyProductionMeetingPage(Page<SafetyProductionMeetingLedgerVo> page, @Param("bo") ReportLedgerQueryBo bo);

    List<OnlineTrainingMonthlyRowVo> selectOnlineTrainingMonthlyRows(@Param("companyId") Long companyId, @Param("trainingId") Long trainingId, @Param("userIds") List<String> userIds);

    /**
     * 从业人员岗前培训明细行（仅在线培训，按创建时间）
     */
    List<PreJobTrainingDetail.PreJobTrainingRow> selectDriverPreJobTrainingRows(@Param("companyId") Long companyId,
                                                                                @Param("userId") String userId,
                                                                                @Param("trainingId") Long trainingId);

    /**
     * 查询驾驶员的所有岗前培训ID列表
     */
    List<Long> selectDriverPreJobTrainingIds(@Param("companyId") Long companyId, @Param("userId") String userId);
}
