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

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.holidayuser.vo.HolidayUserPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.holiday.holidayuser.HolidayUserDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;

/**
 * 员工假期 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface HolidayUserMapper extends BaseMapperX<HolidayUserDO> {

    default PageResult<HolidayUserDO> selectPage(HolidayUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HolidayUserDO>()
                .eqIfPresent(HolidayUserDO::getUserId, reqVO.getUserId())
                .eqIfPresent(HolidayUserDO::getHolidaySettingId, reqVO.getHolidaySettingId())
                .eqIfPresent(HolidayUserDO::getHolidayBalanceSettingId, reqVO.getHolidayBalanceSettingId())
                .eqIfPresent(HolidayUserDO::getHolidayBalance, reqVO.getHolidayBalance())
                .betweenIfPresent(HolidayUserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HolidayUserDO::getId));
    }

    /**
     * 获取分页列表
     *
     * @param pageReqVO
     * @param objectPage
     * @return
     */
    IPage<HolidayUserDO> getPageList(HolidayUserPageReqVO pageReqVO, Page<Object> objectPage);
}
