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

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

/**
 * PMS 货位 Mapper
 *
 * @author ruiqi
 */
@Mapper
public interface IotCargoLocationMapper extends BaseMapperX<IotCargoLocationDO> {

    default PageResult<IotCargoLocationDO> selectPage(IotCargoLocationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotCargoLocationDO>()
                .eqIfPresent(IotCargoLocationDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(IotCargoLocationDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(IotCargoLocationDO::getFactoryCode, reqVO.getFactoryCode())
                .eqIfPresent(IotCargoLocationDO::getCostCenterId, reqVO.getCostCenterId())
                .eqIfPresent(IotCargoLocationDO::getCostCenterCode, reqVO.getCostCenterCode())
                .eqIfPresent(IotCargoLocationDO::getStorageLocationId, reqVO.getStorageLocationId())
                .eqIfPresent(IotCargoLocationDO::getStorageLocationCode, reqVO.getStorageLocationCode())
                .eqIfPresent(IotCargoLocationDO::getShelvesId, reqVO.getShelvesId())
                .eqIfPresent(IotCargoLocationDO::getCode, reqVO.getCode())
                .likeIfPresent(IotCargoLocationDO::getName, reqVO.getName())
                .eqIfPresent(IotCargoLocationDO::getType, reqVO.getType())
                .eqIfPresent(IotCargoLocationDO::getRow, reqVO.getRow())
                .eqIfPresent(IotCargoLocationDO::getLayer, reqVO.getLayer())
                .eqIfPresent(IotCargoLocationDO::getColumnNumber, reqVO.getColumnNumber())
                .eqIfPresent(IotCargoLocationDO::getCapacity, reqVO.getCapacity())
                .eqIfPresent(IotCargoLocationDO::getCurrentUsage, reqVO.getCurrentUsage())
                .eqIfPresent(IotCargoLocationDO::getSort, reqVO.getSort())
                .eqIfPresent(IotCargoLocationDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotCargoLocationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotCargoLocationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotCargoLocationDO::getId));
    }

}