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

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.pms.controller.admin.maintain.materials.vo.IotMaintainMaterialsPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainMaterialsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 维修工单对应物料 Mapper
 *
 * @author 李鹏辉
 */
@Mapper
public interface IotMaintainMaterialsMapper extends BaseMapperX<IotMaintainMaterialsDO> {

    default PageResult<IotMaintainMaterialsDO> selectPage(IotMaintainMaterialsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotMaintainMaterialsDO>()
                .eqIfPresent(IotMaintainMaterialsDO::getMaintainId, reqVO.getMaintainId())
                .eqIfPresent(IotMaintainMaterialsDO::getBomId, reqVO.getBomId())
                .eqIfPresent(IotMaintainMaterialsDO::getBomNodeId, reqVO.getBomNodeId())
                .eqIfPresent(IotMaintainMaterialsDO::getMaterialId, reqVO.getMaterialId())
                .eqIfPresent(IotMaintainMaterialsDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(IotMaintainMaterialsDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(IotMaintainMaterialsDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(IotMaintainMaterialsDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(IotMaintainMaterialsDO::getTotalPrice, reqVO.getTotalPrice())
                .eqIfPresent(IotMaintainMaterialsDO::getTotalInventoryQuantity, reqVO.getTotalInventoryQuantity())
                .eqIfPresent(IotMaintainMaterialsDO::getMaterialSource, reqVO.getMaterialSource())
                .eqIfPresent(IotMaintainMaterialsDO::getInventoryAddress, reqVO.getInventoryAddress())
                .eqIfPresent(IotMaintainMaterialsDO::getSort, reqVO.getSort())
                .eqIfPresent(IotMaintainMaterialsDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotMaintainMaterialsDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotMaintainMaterialsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotMaintainMaterialsDO::getId));
    }

}
