package cn.iocoder.yudao.module.pms.dal.mysql.iotmainplanbommaterial;

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.pms.controller.admin.iotmainplanbommaterial.vo.IotMainPlanBomMaterialPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainplanbommaterial.IotMainPlanBomMaterialDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * PMS 保养计划明细设备BOM挂载物料关联 Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotMainPlanBomMaterialMapper extends BaseMapperX<IotMainPlanBomMaterialDO> {

    default PageResult<IotMainPlanBomMaterialDO> selectPage(IotMainPlanBomMaterialPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotMainPlanBomMaterialDO>()
                .eqIfPresent(IotMainPlanBomMaterialDO::getMainPlanId, reqVO.getMainPlanId())
                .eqIfPresent(IotMainPlanBomMaterialDO::getMainPlanDetailId, reqVO.getMainPlanDetailId())
                .eqIfPresent(IotMainPlanBomMaterialDO::getDeviceCategoryId, reqVO.getDeviceCategoryId())
                .eqIfPresent(IotMainPlanBomMaterialDO::getBomNodeId, reqVO.getBomNodeId())
                .likeIfPresent(IotMainPlanBomMaterialDO::getName, reqVO.getName())
                .eqIfPresent(IotMainPlanBomMaterialDO::getCode, reqVO.getCode())
                .eqIfPresent(IotMainPlanBomMaterialDO::getMaterialId, reqVO.getMaterialId())
                .eqIfPresent(IotMainPlanBomMaterialDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(IotMainPlanBomMaterialDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(IotMainPlanBomMaterialDO::getKilometerCycle, reqVO.getKilometerCycle())
                .eqIfPresent(IotMainPlanBomMaterialDO::getKiloCycleLead, reqVO.getKiloCycleLead())
                .eqIfPresent(IotMainPlanBomMaterialDO::getTimePeriod, reqVO.getTimePeriod())
                .eqIfPresent(IotMainPlanBomMaterialDO::getTimePeriodLead, reqVO.getTimePeriodLead())
                .eqIfPresent(IotMainPlanBomMaterialDO::getNaturalDatePeriod, reqVO.getNaturalDatePeriod())
                .eqIfPresent(IotMainPlanBomMaterialDO::getNaturalDatePeroidLead, reqVO.getNaturalDatePeriodLead())
                .eqIfPresent(IotMainPlanBomMaterialDO::getSort, reqVO.getSort())
                .eqIfPresent(IotMainPlanBomMaterialDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotMainPlanBomMaterialDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotMainPlanBomMaterialDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotMainPlanBomMaterialDO::getId));
    }

}