package com.ruoyi.inventory.mapper;

import java.util.List;
import java.util.Map;

import com.ruoyi.inventory.domain.Warehouses;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * 仓库Mapper接口
 *
 * @author ruoyi
 * @date 2025-12-01
 */
@Mapper
public interface WarehousesMapper
{
    /**
     * 查询仓库
     *
     * @param id 仓库主键
     * @return 仓库
     */
    public Warehouses selectWarehousesById(String id);

    /**
     * 查询仓库列表
     *
     * @param warehouses 仓库
     * @return 仓库集合
     */
    public List<Warehouses> selectWarehousesList(Warehouses warehouses);

    /**
     * 新增仓库
     *
     * @param warehouses 仓库
     * @return 结果
     */
    public int insertWarehouses(Warehouses warehouses);

    /**
     * 修改仓库
     *
     * @param warehouses 仓库
     * @return 结果
     */
    public int updateWarehouses(Warehouses warehouses);

    /**
     * 删除仓库
     *
     * @param id 仓库主键
     * @return 结果
     */
    public int deleteWarehousesById(String id);

    /**
     * 批量删除仓库
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteWarehousesByIds(String[] ids);

    /**
     * 批量删除仓库
     *
     * @param id 需要删除的数据主键集合
     * @return 结果
     */
    @Update("update warehouses set is_enabled = 0 where id=#{id}")
    public int updateWarehouseStatus(String id);

    /**
     * @description: 获取仓库 的 warehouses_code 仓库编码 warehouses_name 做成字典
     * @author cs
     * @date 2025/12/4
     * @version 1.0
     */
    public List<Map<String, Object>> getMapList();

    /**
     * 根据仓库名称精确查询（仅is_used=1）
     * @param name 仓库名称
     * @return 仓库
     */
    Warehouses selectWarehousesByName(String name);

    public int batchInsertWarehouses(List<Warehouses> warehousesList);
}
