package com.zt.plat.module.erp.dal.mysql.erp;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;

import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.WarehouseFactoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 仓库工厂关系 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface WarehouseFactoryMapper extends BaseMapperX<WarehouseFactoryDO> {

    default PageResult<WarehouseFactoryDO> selectPage(WarehouseFactoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WarehouseFactoryDO>()
                .eqIfPresent(WarehouseFactoryDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
                .eqIfPresent(WarehouseFactoryDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
                .eqIfPresent(WarehouseFactoryDO::getOperationType, reqVO.getOperationType())
                .eqIfPresent(WarehouseFactoryDO::getMmsiType, reqVO.getMmsiType())
                .likeIfPresent(WarehouseFactoryDO::getErpSourceFactoryName, reqVO.getErpSourceFactoryName())
                .eqIfPresent(WarehouseFactoryDO::getErpSourceFactoryNumber, reqVO.getErpSourceFactoryNumber())
                .likeIfPresent(WarehouseFactoryDO::getErpSourceWarehouseName, reqVO.getErpSourceWarehouseName())
                .eqIfPresent(WarehouseFactoryDO::getErpSourceWarehouseNumber, reqVO.getErpSourceWarehouseNumber())
                .likeIfPresent(WarehouseFactoryDO::getErpTargetFactoryName, reqVO.getErpTargetFactoryName())
                .eqIfPresent(WarehouseFactoryDO::getErpTargetFactoryNumber, reqVO.getErpTargetFactoryNumber())
                .likeIfPresent(WarehouseFactoryDO::getErpTargetWarehouseName, reqVO.getErpTargetWarehouseName())
                .eqIfPresent(WarehouseFactoryDO::getErpTargetWarehouseNumber, reqVO.getErpTargetWarehouseNumber())
                .betweenIfPresent(WarehouseFactoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WarehouseFactoryDO::getId));
    }

}