package org.dromara.zhishu.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.zhishu.domain.TFreight;
import org.dromara.zhishu.domain.bo.TFreightBo;
import org.dromara.zhishu.domain.vo.TFreightVo;
import org.dromara.zhishu.domain.vo.TShelvesVo;

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

/**
 * 三级货区管理Mapper接口
 *
 * @author Lion Li
 * @date 2025-04-19
 */
@Mapper
public interface TFreightMapper extends BaseMapperPlus<TFreight, TFreightVo> {

    @Select("select id from t_freight where code = #{freightName} AND shelves_id = #{shelvesId}")
    Long getFreightIdByName(String freightName, Long shelvesId);

    /**
     * 根据三级获取名称获取获取信息
     * @param freightName
     * @param shelvesId
     * @return
     */
    TFreightVo selectByFreightName(@Param("freightName") String freightName,@Param("shelvesId") Long shelvesId);


    List<Long> selectDepotId(Long userId);

    List<TShelvesVo> selectByList(List<Long> depotIdList);

    String setShelvesName(Long id);

    List<TFreightVo> selectByShelvesId(Long shelvesId);

    Map selectByFreightId(Long freightId);
//    List<String> selectCode(Collection<Long> ids);

//    Integer selectByCount2(Long userId,String code);

//    Integer selectByCount1(Long userId,String code);


    String selectByCode(Long shelvesId);

    Integer selectFreName(String name, Long shelvesId,String code);

    List<Long> selectV(Long userId);

    List<Long> selectShe(List<Long> depotids);

    Page<TFreightVo> selectVo(Page<Object> build, TFreightBo bo, List<Long> sheIds);

    int insertFre(TFreight add);

    List<TFreightVo> selectVoLists(List<Long> sheIds);

    int updateBydate(TFreight update);

    TFreight selectSheName(Long id);

    TShelvesVo setShelvesName1(Long id);

    String selectDepotCode(String depotId);

    List<TFreightVo> selectListVo(Collection<Long> ids,Long userId);

    Integer selectByExcludeCurrent(String name, Long shelvesId, Long freightId);
}
