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

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.iotsappickinglist.vo.IotSapPickingListPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotsappickinglist.IotSapPickingListDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * PMS SAP 领料单 Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotSapPickingListMapper extends BaseMapperX<IotSapPickingListDO> {

    default PageResult<IotSapPickingListDO> selectPage(IotSapPickingListPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotSapPickingListDO>()
                .eqIfPresent(IotSapPickingListDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(IotSapPickingListDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(IotSapPickingListDO::getFactory, reqVO.getFactory())
                .eqIfPresent(IotSapPickingListDO::getCostCenterId, reqVO.getCostCenterId())
                .eqIfPresent(IotSapPickingListDO::getCostCenter, reqVO.getCostCenter())
                .eqIfPresent(IotSapPickingListDO::getStorageLocationId, reqVO.getStorageLocationId())
                .eqIfPresent(IotSapPickingListDO::getStorageLocation, reqVO.getStorageLocation())
                .eqIfPresent(IotSapPickingListDO::getNumber, reqVO.getNumber())
                .eqIfPresent(IotSapPickingListDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(IotSapPickingListDO::getMaterialName, reqVO.getMaterialName())
                .likeIfPresent(IotSapPickingListDO::getMaterialGroupName, reqVO.getMaterialGroupName())
                .eqIfPresent(IotSapPickingListDO::getMaterialGroupId, reqVO.getMaterialGroupId())
                .eqIfPresent(IotSapPickingListDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(IotSapPickingListDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(IotSapPickingListDO::getUnit, reqVO.getUnit())
                .eqIfPresent(IotSapPickingListDO::getSyncStatus, reqVO.getSyncStatus())
                .betweenIfPresent(IotSapPickingListDO::getSyncTime, reqVO.getSyncTime())
                .eqIfPresent(IotSapPickingListDO::getSyncError, reqVO.getSyncError())
                .eqIfPresent(IotSapPickingListDO::getSort, reqVO.getSort())
                .eqIfPresent(IotSapPickingListDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotSapPickingListDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotSapPickingListDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotSapPickingListDO::getId));
    }

    default List<IotSapPickingListDO> selectList(IotSapPickingListPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<IotSapPickingListDO>()
                .eqIfPresent(IotSapPickingListDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(IotSapPickingListDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(IotSapPickingListDO::getFactory, reqVO.getFactory())
                .eqIfPresent(IotSapPickingListDO::getCostCenterId, reqVO.getCostCenterId())
                .eqIfPresent(IotSapPickingListDO::getCostCenter, reqVO.getCostCenter())
                .eqIfPresent(IotSapPickingListDO::getStorageLocationId, reqVO.getStorageLocationId())
                .eqIfPresent(IotSapPickingListDO::getStorageLocation, reqVO.getStorageLocation())
                .eqIfPresent(IotSapPickingListDO::getNumber, reqVO.getNumber())
                .eqIfPresent(IotSapPickingListDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(IotSapPickingListDO::getMaterialName, reqVO.getMaterialName())
                .likeIfPresent(IotSapPickingListDO::getMaterialGroupName, reqVO.getMaterialGroupName())
                .eqIfPresent(IotSapPickingListDO::getMaterialGroupId, reqVO.getMaterialGroupId())
                .eqIfPresent(IotSapPickingListDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(IotSapPickingListDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(IotSapPickingListDO::getUnit, reqVO.getUnit())
                .eqIfPresent(IotSapPickingListDO::getSyncStatus, reqVO.getSyncStatus())
                .betweenIfPresent(IotSapPickingListDO::getSyncTime, reqVO.getSyncTime())
                .eqIfPresent(IotSapPickingListDO::getSyncError, reqVO.getSyncError())
                .eqIfPresent(IotSapPickingListDO::getSort, reqVO.getSort())
                .eqIfPresent(IotSapPickingListDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotSapPickingListDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotSapPickingListDO::getCreateTime, reqVO.getCreateTime()));
    }

}