package com.yc.ship.module.product.service.voyagestockdistribute;

import com.yc.ship.framework.common.util.collection.CollectionUtils;
import com.yc.ship.module.product.controller.admin.voyagestockdistributeNew.vo.VoyageStockDistributeNewDetailReqVO;
import com.yc.ship.module.product.controller.app.voyage.vo.AppCanSelectRoomReqVO;
import com.yc.ship.module.product.dal.dataobject.voyagestockdistribute.VoyageStockDistributeRoomDO;
import com.yc.ship.module.product.dal.mysql.voyagestockdistribute.VoyageStockDistributeRoomMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;

/**
 * 航次库存分配给商家的房间 Service 实现类
 *
 * @author 管理员
 */
@Service
@Validated
public class VoyageStockDistributeRoomServiceImpl implements VoyageStockDistributeRoomService {

    @Resource
    private VoyageStockDistributeRoomMapper voyageStockDistributeRoomMapper;


    @Override
    public List<VoyageStockDistributeRoomDO> getListByVoyageId(Long voyageId, Integer type) {
        return voyageStockDistributeRoomMapper.selectListByVoyageId(voyageId,  type);
    }

    @Override
    public void deleteByVoyageId(Long voyageId, Integer type) {
        voyageStockDistributeRoomMapper.deleteByVoyageId(voyageId, type);
    }

    @Override
    public void createVoyageStockDistributeRoomBatch(List<VoyageStockDistributeRoomDO> roomList) {
        if(CollectionUtils.isAnyEmpty()) {
            return;
        }
        voyageStockDistributeRoomMapper.insertBatch(roomList);
    }

    @Override
    public List<VoyageStockDistributeRoomDO> getRoomListByRoomModelIdAndFloor(Long objectId, Long voyageId, List<String> roomModelIdFloorList) {
        return voyageStockDistributeRoomMapper.selectListByRoomModelIdAndFloor(objectId, voyageId, roomModelIdFloorList);
    }

    @Override
    public List<VoyageStockDistributeRoomDO> getListByVoyageIdAndObjectId(VoyageStockDistributeNewDetailReqVO reqVO) {
        return voyageStockDistributeRoomMapper.selectListByVoyageIdAndObjectId(reqVO);
    }

    @Override
    public List<VoyageStockDistributeRoomDO> getAppCanSelectRoomList(AppCanSelectRoomReqVO reqVO) {
        return voyageStockDistributeRoomMapper.selectAppCanSelectRoomList(reqVO);
    }
}