package cn.iocoder.yudao.module.system.dal.mysql.holiday.holidayuserrecord;

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.holiday.holidayuserrecord.vo.HolidayUserRecordPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.holiday.holidayuserrecord.HolidayUserRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 员工假期记录 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface HolidayUserRecordMapper extends BaseMapperX<HolidayUserRecordDO> {

    default PageResult<HolidayUserRecordDO> selectPage(HolidayUserRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HolidayUserRecordDO>()
                .eqIfPresent(HolidayUserRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(HolidayUserRecordDO::getHolidayUserId, reqVO.getHolidayUserId())
                .eqIfPresent(HolidayUserRecordDO::getHolidaySettingId, reqVO.getHolidaySettingId())
                .eqIfPresent(HolidayUserRecordDO::getHolidayBalanceSettingId, reqVO.getHolidayBalanceSettingId())
                .eqIfPresent(HolidayUserRecordDO::getDirection, reqVO.getDirection())
                .eqIfPresent(HolidayUserRecordDO::getHolidayBalance, reqVO.getHolidayBalance())
                .eqIfPresent(HolidayUserRecordDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(HolidayUserRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HolidayUserRecordDO::getId));
    }

}
