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

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.AttendanceStatisticsPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.attendance.statistics.AttendanceStatisticsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 考勤统计 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface AttendanceStatisticsMapper extends BaseMapperX<AttendanceStatisticsDO> {

    default PageResult<AttendanceStatisticsDO> selectPage(AttendanceStatisticsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AttendanceStatisticsDO>()
                .eqIfPresent(AttendanceStatisticsDO::getUserId, reqVO.getUserId())
                .eqIfPresent(AttendanceStatisticsDO::getAttendanceGroupId, reqVO.getAttendanceGroupId())
                .likeIfPresent(AttendanceStatisticsDO::getAttendanceGroupName, reqVO.getAttendanceGroupName())
                .eqIfPresent(AttendanceStatisticsDO::getAttendanceGroupShiftId, reqVO.getAttendanceGroupShiftId())
                .likeIfPresent(AttendanceStatisticsDO::getAttendanceGroupShiftName, reqVO.getAttendanceGroupShiftName())
                .betweenIfPresent(AttendanceStatisticsDO::getDayTime, reqVO.getDayTime())
                .eqIfPresent(AttendanceStatisticsDO::getAbnormalFlag, reqVO.getAbnormalFlag())
                .eqIfPresent(AttendanceStatisticsDO::getWorkingHours, reqVO.getWorkingHours())
                .betweenIfPresent(AttendanceStatisticsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AttendanceStatisticsDO::getId));
    }

}