package cn.iocoder.yudao.module.system.dal.mysql.attendance.factorypunchrecord;

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.system.controller.admin.attendance.vo.AttendanceFactoryPunchRecordPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.attendance.factorypunchrecord.AttendanceFactoryPunchRecordDO;
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 AttendanceFactoryPunchRecordMapper extends BaseMapperX<AttendanceFactoryPunchRecordDO> {

    default PageResult<AttendanceFactoryPunchRecordDO> selectPage(AttendanceFactoryPunchRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AttendanceFactoryPunchRecordDO>()
                .eqIfPresent(AttendanceFactoryPunchRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(AttendanceFactoryPunchRecordDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(AttendanceFactoryPunchRecordDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(AttendanceFactoryPunchRecordDO::getSn, reqVO.getSn())
                .betweenIfPresent(AttendanceFactoryPunchRecordDO::getActualDayTime, reqVO.getActualDayTime())
                .betweenIfPresent(AttendanceFactoryPunchRecordDO::getPunchTime, reqVO.getPunchTime())
                .eqIfPresent(AttendanceFactoryPunchRecordDO::getImage, reqVO.getImage())
                .betweenIfPresent(AttendanceFactoryPunchRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AttendanceFactoryPunchRecordDO::getId));
    }

    /**
     * 分野获取
     *
     * @param vo
     * @param objectPage
     * @return
     */
    IPage<AttendanceFactoryPunchRecordDO> getAttendanceFactoryPunchRecordPage(@Param("vo") AttendanceFactoryPunchRecordPageReqVO vo, @Param("page") Page<Object> objectPage);
}
