package cn.iocoder.yudao.module.system.dal.mysql.workovertime;

import java.util.*;

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.workovertime.WorkOvertimeRuleItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.workovertime.vo.*;

/**
 * 加班规则子表(按日类型区分) Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface WorkOvertimeRuleItemMapper extends BaseMapperX<WorkOvertimeRuleItemDO> {

    default PageResult<WorkOvertimeRuleItemDO> selectPage(WorkOvertimeRuleItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkOvertimeRuleItemDO>()
                .eqIfPresent(WorkOvertimeRuleItemDO::getRuleId, reqVO.getRuleId())
                .eqIfPresent(WorkOvertimeRuleItemDO::getType, reqVO.getType())
                .eqIfPresent(WorkOvertimeRuleItemDO::getStatus, reqVO.getStatus())
                .eqIfPresent(WorkOvertimeRuleItemDO::getAllowOvertimeTimeType, reqVO.getAllowOvertimeTimeType())
                .eqIfPresent(WorkOvertimeRuleItemDO::getCalculationMode, reqVO.getCalculationMode())
                .betweenIfPresent(WorkOvertimeRuleItemDO::getOvertimeStartingTime, reqVO.getOvertimeStartingTime())
                .betweenIfPresent(WorkOvertimeRuleItemDO::getBeforeWorkOvertime, reqVO.getBeforeWorkOvertime())
                .betweenIfPresent(WorkOvertimeRuleItemDO::getAfterWorkOvertime, reqVO.getAfterWorkOvertime())
                .eqIfPresent(WorkOvertimeRuleItemDO::getOvertimeTotalHours, reqVO.getOvertimeTotalHours())
                .betweenIfPresent(WorkOvertimeRuleItemDO::getIsDeductBreakTime, reqVO.getIsDeductBreakTime())
                .eqIfPresent(WorkOvertimeRuleItemDO::getIsTransformation, reqVO.getIsTransformation())
                .eqIfPresent(WorkOvertimeRuleItemDO::getTransformationType, reqVO.getTransformationType())
                .eqIfPresent(WorkOvertimeRuleItemDO::getCompensatoryLeaveRatio, reqVO.getCompensatoryLeaveRatio())
                .eqIfPresent(WorkOvertimeRuleItemDO::getHolidayId, reqVO.getHolidayId())
                .betweenIfPresent(WorkOvertimeRuleItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkOvertimeRuleItemDO::getId));
    }

}