package org.dromara.zhishu.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.zhishu.domain.TFreight;
import org.dromara.zhishu.domain.TShelves;
import org.dromara.zhishu.domain.bo.TShelvesBo;
import org.dromara.zhishu.domain.vo.TDepotVo;
import org.dromara.zhishu.domain.vo.TShelvesVo;
import org.springframework.data.repository.query.Param;

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

/**
 * 货架信息Mapper接口
 *
 * @author Lion Li
 * @date 2025-03-26
 */
@Mapper
public interface TShelvesMapper extends BaseMapperPlus<TShelves, TShelvesVo> {

//    @Select("select count(1) from t_shelves where code=#{code} and depot_id=#{depotId}")
    Integer selectByCode(String code, Long depotId, String sheName);

    String selectByName(Long shelvesId,Long userId);


//    @Update("update t_shelves set  depot_id=#{depotId} where id=#{id};")
    Integer updateByShe(Long id, Long depotId);

    Integer insertFre(@Param("id") Long id,@Param("numbers1") List<Integer> numbers1);

//    @Update("update t_depot set  she_quantity_max=she_quantity_max+#{sheCap} where id=#{depotId} and user_id=#{userId}")
//    void updateSheFre(Long depotId, Long userId);

    String selectBySCode(Long depotId);

    String selectByFreCode(Long freId);//查询货位code

    String selectFreCode(String depotCode, Long userId);


    void deleteByIdShe(Collection<Long> ids);

    Page<TShelvesVo> selectVo(@Param("build") Page<Object> build,@Param("bo") TShelvesBo bo,@Param("depotids") List<Long> depotids);

    List<Long> selectV(Long userId);

    List<TShelves> selectM(Long userId);

    int insertBo(TShelves add);

    List<TShelvesVo> selectList1(Long userId);


    int updateShe(TShelves update);

    Integer selectNumber(Long depotId);

    Integer selectcount(Long depotId);


    Long selectBo(Long depotId, String code);

//    List<String> selectByCodes(Collection<Long> ids);

    Integer selectCounts(Long userId, String code);

    String selectSCode(Long sheId);

    Integer selectCounts1(Long userId, String code);

    List<TFreight> selectFList(Long userId);

    String selectDName(Long depotId,Long userId);

    String selectDepotName(String depotId);

    TDepotVo selectByName1(Long id, Long userId);

    TDepotVo selectDepot(String depotId);

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

    List<TShelvesVo> selectShelvesIdByDepotIdAndCode(String depotId, String code);

    List<TShelvesVo> selectShelvesByDepotId(String depotId);

    Long selectDepotIdByShelvesId(Long shelvesId);

    TShelvesVo selectForLocal(Long depotId, String code);

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