package com.zbf.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbf.system.domain.TBaseStorageAreaLocation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 库位 Mapper接口
 *
 * @author tony
 * @date 2024-06-14
 */
public interface TBaseStorageAreaLocationMapper extends BaseMapper<TBaseStorageAreaLocation> //修改
{
    /**
     * 查询库位
     *
     * @param id 库位 主键
     * @return 库位
     */
    public TBaseStorageAreaLocation selectTBaseStorageAreaLocationById(Long id);

    /**
     * 查询库位 列表
     *
     * @param tBaseStorageAreaLocation 库位
     * @return 库位 集合
     */
    public List<TBaseStorageAreaLocation> selectTBaseStorageAreaLocationList(TBaseStorageAreaLocation tBaseStorageAreaLocation);

    /**
     * 新增库位
     *
     * @param tBaseStorageAreaLocation 库位
     * @return 结果
     */
    public int insertTBaseStorageAreaLocation(TBaseStorageAreaLocation tBaseStorageAreaLocation);

    /**
     * 修改库位
     *
     * @param tBaseStorageAreaLocation 库位
     * @return 结果
     */
    public int updateTBaseStorageAreaLocation(TBaseStorageAreaLocation tBaseStorageAreaLocation);

    /**
     * 删除库位
     *
     * @param id 库位 主键
     * @return 结果
     */
    public int deleteTBaseStorageAreaLocationById(Long id);

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

    /**
     * 批量启用库位
     *
     * @param ids 需要启用的数据主键集合
     * @return 结果
     */
    public int enableTBaseStorageAreaLocationByIds(Long[] ids);

    /**
     * 批量禁用库位
     *
     * @param ids 需要禁用的数据主键集合
     * @return 结果
     */
    public int disabledTBaseStorageAreaLocationByIds(Long[] ids);

    List<TBaseStorageAreaLocation> selectFreeLoc(@Param("decid") String decid);

    List<TBaseStorageAreaLocation> occupy();

    void updateLocationSts(TBaseStorageAreaLocation tBaseStorageAreaLocation);

    void updateLockStatus(TBaseStorageAreaLocation tBaseStorageAreaLocation);
    @Select("update t_base_storage_area_location set status = '1' where location_id in (SELECT DISTINCT location_id FROM t_mi_stock WHERE location_id IS NOT NULL)")
    void updateLocation();
}
