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

import java.util.*;

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

import com.zt.plat.framework.tenant.core.aop.TenantIgnore;
import com.zt.plat.module.erp.controller.admin.erp.internalwarehouse.vo.InternalWarehousePageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.internalwarehouse.InternalWarehouseDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


/**
 * ERP库位 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface InternalWarehouseMapper extends BaseMapperX<InternalWarehouseDO> {

    default PageResult<InternalWarehouseDO> selectPage(InternalWarehousePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InternalWarehouseDO>()
                .eqIfPresent(InternalWarehouseDO::getFactoryNumber, reqVO.getFactoryNumber())
                .likeIfPresent(InternalWarehouseDO::getName, reqVO.getName())
                .eqIfPresent(InternalWarehouseDO::getNumber, reqVO.getNumber())
                .eqIfPresent(InternalWarehouseDO::getType, reqVO.getType())
                .likeIfPresent(InternalWarehouseDO::getRelativityName, reqVO.getRelativityName())
                .eqIfPresent(InternalWarehouseDO::getRelativityNumber, reqVO.getRelativityNumber())
                .eqIfPresent(InternalWarehouseDO::getIsEnable, reqVO.getIsEnable())
                .betweenIfPresent(InternalWarehouseDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(InternalWarehouseDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
                .eqIfPresent(InternalWarehouseDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
                .orderByDesc(InternalWarehouseDO::getId));
    }
    @Select("SELECT * FROM bse_intl_wrh WHERE NUM = #{number}")
    @TenantIgnore
    InternalWarehouseDO selectInternalWarehouseDOByNumber(String number);

}