package com.sw.common.accessory.server.mapper;

import com.sw.common.accessory.server.dto.EquipmentAccessBo;
import com.sw.common.accessory.server.entity.EquipmentAccessory;
import com.sw.common.core.request.RequestPage;
import com.sw.common.mybatisplus.base.BaseDao;
import com.sw.common.mybatisplus.entity.Pageable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
@Mapper
public interface EquipmentAccessoryMapper extends BaseDao<EquipmentAccessory> {
    EquipmentAccessory findByEquipmentCode(@Param("equipmentCode") String equipmentCode);


    int updateStockReturnCount(@Param("equipmentAccessoryId") Long equipmentAccessoryId, @Param("stockReturnCount") Integer stockReturnCount, @Param("number") int number);

    int updateBoardingCount(@Param("equipmentAccessoryId") Long equipmentAccessoryId, @Param("boardingCount") int boardingCount, @Param("number") int number);

    /**
     * 更新辅料信息中的待出库信息
     *
     * @param equipmentAccessoryId                   辅料信息主键id
     * @param waitingOutboundCount 待出库数量
     * @param number               需增加或减少的数量
     * @return 修改的行数
     */
    int updateWaitingOutboundCount(@Param("equipmentAccessoryId") Long equipmentAccessoryId, @Param("waitingOutboundCount") Integer waitingOutboundCount, @Param("number") int number);

    int updateWaitingBoardingCount(@Param("equipmentAccessoryId") Long equipmentAccessoryId, @Param("waitingBoardingCount") int waitingBoardingCount, @Param("number") int number);


    List<EquipmentAccessory> pages(@Param("bo") EquipmentAccessBo bo,@Param("requestPage") Pageable pageable);
    int pageCount(@Param("bo") EquipmentAccessBo bo);
}