package cn.iocoder.yudao.module.mes.dal.mysql.workreportplan;

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.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.*;

/**
 * 报工分配计划 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface WorkReportPlanMapper extends BaseMapperX<WorkReportPlanDO> {

    default PageResult<WorkReportPlanDO> selectPage(WorkReportPlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkReportPlanDO>()
                .eqIfPresent(WorkReportPlanDO::getReportId, reqVO.getReportId())
                .eqIfPresent(WorkReportPlanDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(WorkReportPlanDO::getTaskDetailId, reqVO.getTaskDetailId())
                .eqIfPresent(WorkReportPlanDO::getProductId, reqVO.getProductId())
                .eqIfPresent(WorkReportPlanDO::getQualityNumberPlan, reqVO.getQualityNumberPlan())
                .eqIfPresent(WorkReportPlanDO::getWasteNumberPlan, reqVO.getWasteNumberPlan())
                .eqIfPresent(WorkReportPlanDO::getReportTimePlan, reqVO.getReportTimePlan())
                .eqIfPresent(WorkReportPlanDO::getTotalTimePlan, reqVO.getTotalTimePlan())
                .betweenIfPresent(WorkReportPlanDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkReportPlanDO::getId));
    }

}