package cn.iocoder.yudao.module.smartfactory.dal.mysql.staffcertificateinformation;

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.smartfactory.controller.admin.staffcertificateinformation.vo.StaffCertificateInformationPageReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffcertificateinformation.StaffCertificateInformationDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 叉车员工证件信息 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface StaffCertificateInformationMapper extends BaseMapperX<StaffCertificateInformationDO> {

    default PageResult<StaffCertificateInformationDO> selectPage(StaffCertificateInformationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StaffCertificateInformationDO>()
                .eqIfPresent(StaffCertificateInformationDO::getStaffId, reqVO.getStaffId())
                .eqIfPresent(StaffCertificateInformationDO::getIdCardFront, reqVO.getIdCardFront())
                .eqIfPresent(StaffCertificateInformationDO::getIdCardReverse, reqVO.getIdCardReverse())
                .eqIfPresent(StaffCertificateInformationDO::getForkliftCertificate, reqVO.getForkliftCertificate())
                .eqIfPresent(StaffCertificateInformationDO::getForkliftAnnualInspection, reqVO.getForkliftAnnualInspection())
                .betweenIfPresent(StaffCertificateInformationDO::getForkliftAnnualInspectionExpiredTime, reqVO.getForkliftAnnualInspectionExpiredTime())
                .betweenIfPresent(StaffCertificateInformationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StaffCertificateInformationDO::getId));
    }

    /**
     * 通过id获取
     *
     * @param id
     * @return
     */
    StaffCertificateInformationDO getStaffCertificateInformation(@Param("id") Long id);

    /**
     * 分页列表
     *
     * @param page
     * @param vo
     * @return
     */
    IPage<StaffCertificateInformationDO> getStaffCertificateInformationPage(@Param("page") Page page, @Param("vo") StaffCertificateInformationPageReqVO vo);
}
