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

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

/**
 * 维保计划 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface DvCheckMapper extends BaseMapperX<DvCheckDO> {

    default PageResult<DvCheckDO> selectPage(DvCheckPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DvCheckDO>()
                .eqIfPresent(DvCheckDO::getPlanCode, reqVO.getPlanCode())
                .likeIfPresent(DvCheckDO::getPlanName, reqVO.getPlanName())
                .eqIfPresent(DvCheckDO::getPlanType, reqVO.getPlanType())
                .betweenIfPresent(DvCheckDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(DvCheckDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(DvCheckDO::getStatus, reqVO.getStatus())
                .eqIfPresent(DvCheckDO::getRemark, reqVO.getRemark())
                .eqIfPresent(DvCheckDO::getIsEnable, reqVO.getIsEnable())
                .betweenIfPresent(DvCheckDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DvCheckDO::getCycleUnit, reqVO.getCycleUnit())
                .eqIfPresent(DvCheckDO::getCycleCount, reqVO.getCycleCount())
                .eqIfPresent(DvCheckDO::getPlanLevel, reqVO.getPlanLevel())
                .betweenIfPresent(DvCheckDO::getLastTime, reqVO.getLastTime())
                .eqIfPresent(DvCheckDO::getFormulaCode, reqVO.getFormulaCode())
                .orderByDesc(DvCheckDO::getId));
    }

}