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

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.attendance.punchrecord.AttendancePunchRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.*;

/**
 * 用户打卡记录 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface AttendancePunchRecordMapper extends BaseMapperX<AttendancePunchRecordDO> {

    default PageResult<AttendancePunchRecordDO> selectPage(AttendancePunchRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AttendancePunchRecordDO>()
                .eqIfPresent(AttendancePunchRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(AttendancePunchRecordDO::getAttendanceGroupId, reqVO.getAttendanceGroupId())
                .eqIfPresent(AttendancePunchRecordDO::getAttendanceGroupShiftId, reqVO.getAttendanceGroupShiftId())
                .eqIfPresent(AttendancePunchRecordDO::getType, reqVO.getType())
                .eqIfPresent(AttendancePunchRecordDO::getPunchType, reqVO.getPunchType())
                .eqIfPresent(AttendancePunchRecordDO::getStatus, reqVO.getStatus())
                .eqIfPresent(AttendancePunchRecordDO::getFieldServiceFlag, reqVO.getFieldServiceFlag())
                .betweenIfPresent(AttendancePunchRecordDO::getDayTime, reqVO.getDayTime())
                .betweenIfPresent(AttendancePunchRecordDO::getPunchTime, reqVO.getPunchTime())
                .eqIfPresent(AttendancePunchRecordDO::getRemark, reqVO.getRemark())
                .eqIfPresent(AttendancePunchRecordDO::getImage, reqVO.getImage())
                .betweenIfPresent(AttendancePunchRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AttendancePunchRecordDO::getId));
    }

}