package com.hw.wms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsBaseWarehouseMapper;
import com.hw.wms.domain.WmsBaseWarehouse;
import com.hw.wms.service.IWmsBaseWarehouseService;

/**
 * 仓库Service业务层处理
 *
 * @author xs
 * @date 2023-12-20
 */
@Service
public class WmsBaseWarehouseServiceImpl implements IWmsBaseWarehouseService
{
    @Autowired
    private WmsBaseWarehouseMapper wmsBaseWarehouseMapper;

    /**
     * 查询仓库
     *
     * @param warehouseId 仓库主键
     * @return 仓库
     */
    @Override
    public WmsBaseWarehouse selectWmsBaseWarehouseByWarehouseId(Long warehouseId)
    {
        return wmsBaseWarehouseMapper.selectWmsBaseWarehouseWithLocationByWarehouseId(warehouseId);
    }

    /**
     * 查询仓库列表
     *
     * @param wmsBaseWarehouse 仓库
     * @return 仓库
     */
    @Override
    public List<WmsBaseWarehouse> selectWmsBaseWarehouseList(WmsBaseWarehouse wmsBaseWarehouse)
    {
        return wmsBaseWarehouseMapper.selectWmsBaseWarehouseList(wmsBaseWarehouse);
    }

    /**
     * 新增仓库
     *
     * @param wmsBaseWarehouse 仓库
     * @return 结果
     */
    @Override
    public int insertWmsBaseWarehouse(WmsBaseWarehouse wmsBaseWarehouse)
    {
        wmsBaseWarehouse.setCreateTime(DateUtils.getNowDate());
        return wmsBaseWarehouseMapper.insertWmsBaseWarehouse(wmsBaseWarehouse);
    }

    /**
     * 修改仓库
     *
     * @param wmsBaseWarehouse 仓库
     * @return 结果
     */
    @Override
    public int updateWmsBaseWarehouse(WmsBaseWarehouse wmsBaseWarehouse)
    {
        wmsBaseWarehouse.setUpdateTime(DateUtils.getNowDate());
        return wmsBaseWarehouseMapper.updateWmsBaseWarehouse(wmsBaseWarehouse);
    }

    /**
     * 批量删除仓库
     *
     * @param warehouseIds 需要删除的仓库主键
     * @return 结果
     */
    @Override
    public int deleteWmsBaseWarehouseByWarehouseIds(Long[] warehouseIds)
    {
        return wmsBaseWarehouseMapper.deleteWmsBaseWarehouseByWarehouseIds(warehouseIds);
    }

    /**
     * 删除仓库信息
     *
     * @param warehouseId 仓库主键
     * @return 结果
     */
    @Override
    public int deleteWmsBaseWarehouseByWarehouseId(Long warehouseId)
    {
        return wmsBaseWarehouseMapper.deleteWmsBaseWarehouseByWarehouseId(warehouseId);
    }


    /**
     * 查询仓库列表Join category
     *
     * @param wmsBaseWarehouse 仓库
     * @return 仓库
     */
    @Override
    public List<WmsBaseWarehouse> selectWmsBaseWarehouseJoinList(WmsBaseWarehouse wmsBaseWarehouse)
    {
        return wmsBaseWarehouseMapper.selectWmsBaseWarehouseJoinList(wmsBaseWarehouse);
    }

}
