package cn.iocoder.yudao.module.wms.dal.mysql.depot;

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.wms.controller.admin.depot.vo.DepotPageReqVO;
import cn.iocoder.yudao.module.wms.controller.admin.depot.vo.DepotRespVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.depot.DepotDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 仓库管理 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface DepotMapper extends BaseMapperX<DepotDO> {

    default PageResult<DepotDO> selectPage(DepotPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DepotDO>()
                .eqIfPresent(DepotDO::getFactoryId, reqVO.getFactoryId())
                .likeIfPresent(DepotDO::getDepotName, reqVO.getDepotName())
                .eqIfPresent(DepotDO::getDepotNo, reqVO.getDepotNo())
                .eqIfPresent(DepotDO::getPrincipal, reqVO.getPrincipal())
                .eqIfPresent(DepotDO::getPhone, reqVO.getPhone())
                .betweenIfPresent(DepotDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DepotDO::getId));
    }

    List<DepotRespVO> selectAllList(DepotPageReqVO reqVO);
}
