package cn.iocoder.yudao.module.pms.dal.mysql.qhse.report;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthReportPageReqVO;
import cn.iocoder.yudao.module.pms.controller.admin.qhse.report.vo.QhseMonthReportRespVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.report.QhseMonthReportDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;

/**
 * 资料 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface QhseMonthReportMapper extends BaseMapperX<QhseMonthReportDO> {

    default PageResult<QhseMonthReportDO> selectPage(QhseMonthReportPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<QhseMonthReportDO>()
                .eqIfPresent(QhseMonthReportDO::getEmployee, reqVO.getEmployee())
                .eqIfPresent(QhseMonthReportDO::getSubcontractors, reqVO.getSubcontractors())
                .eqIfPresent(QhseMonthReportDO::getDrivingMileage, reqVO.getDrivingMileage())
                .eqIfPresent(QhseMonthReportDO::getTotalManHours, reqVO.getTotalManHours())
                .eqIfPresent(QhseMonthReportDO::getWithoutAccident, reqVO.getWithoutAccident())
                .eqIfPresent(QhseMonthReportDO::getFatality, reqVO.getFatality())
                .eqIfPresent(QhseMonthReportDO::getInjury, reqVO.getInjury())
                .eqIfPresent(QhseMonthReportDO::getRestrictedCase, reqVO.getRestrictedCase())
                .eqIfPresent(QhseMonthReportDO::getMedicalCase, reqVO.getMedicalCase())
                .eqIfPresent(QhseMonthReportDO::getFirstAidCase, reqVO.getFirstAidCase())
                .eqIfPresent(QhseMonthReportDO::getVehicleAccident, reqVO.getVehicleAccident())
                .eqIfPresent(QhseMonthReportDO::getNearMiss, reqVO.getNearMiss())
                .eqIfPresent(QhseMonthReportDO::getSpill, reqVO.getSpill())
                .eqIfPresent(QhseMonthReportDO::getLifeSavingRules, reqVO.getLifeSavingRules())
                .eqIfPresent(QhseMonthReportDO::getToolboxTalk, reqVO.getToolboxTalk())
                .eqIfPresent(QhseMonthReportDO::getCommitteeMeeting, reqVO.getCommitteeMeeting())
                .eqIfPresent(QhseMonthReportDO::getMonthlyMeeting, reqVO.getMonthlyMeeting())
                .eqIfPresent(QhseMonthReportDO::getCompanyHazard, reqVO.getCompanyHazard())
                .eqIfPresent(QhseMonthReportDO::getQhseInspection, reqVO.getQhseInspection())
                .eqIfPresent(QhseMonthReportDO::getSocCards, reqVO.getSocCards())
                .eqIfPresent(QhseMonthReportDO::getPtwAudit, reqVO.getPtwAudit())
                .eqIfPresent(QhseMonthReportDO::getJsa, reqVO.getJsa())
                .eqIfPresent(QhseMonthReportDO::getDrills, reqVO.getDrills())
                .eqIfPresent(QhseMonthReportDO::getTraining, reqVO.getTraining())
                .eqIfPresent(QhseMonthReportDO::getParticipantsTraining, reqVO.getParticipantsTraining())
                .eqIfPresent(QhseMonthReportDO::getTrainingsHours, reqVO.getTrainingsHours())
                .eqIfPresent(QhseMonthReportDO::getWaterConsumption, reqVO.getWaterConsumption())
                .eqIfPresent(QhseMonthReportDO::getDieselConsumption, reqVO.getDieselConsumption())
                .eqIfPresent(QhseMonthReportDO::getElectricityConsumption, reqVO.getElectricityConsumption())
                .eqIfPresent(QhseMonthReportDO::getNaturalGasConsumption, reqVO.getNaturalGasConsumption())
                .eqIfPresent(QhseMonthReportDO::getRemark, reqVO.getRemark())
                .eqIfPresent(QhseMonthReportDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(QhseMonthReportDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(QhseMonthReportDO::getId));
    }

    IPage<QhseMonthReportRespVO> getDistinctYearMonths(IPage<QhseMonthReportPageReqVO> page, @Param("reqVO")  QhseMonthReportPageReqVO reqVO, @Param("deptIds") Collection<Long> deptIds);

}