package com.yc.ship.module.product.dal.mysql.voyagestockdetail;

import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.framework.tenant.core.aop.TenantIgnore;
import com.yc.ship.module.product.dal.dataobject.voyagestockdetail.VoyageStockDetailDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 航次库存 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface VoyageStockDetailMapper extends BaseMapperX<VoyageStockDetailDO> {


    @TenantIgnore
    default List<VoyageStockDetailDO> selectListByVoyageId(Long voyageId) {
        return selectList(new LambdaQueryWrapperX<VoyageStockDetailDO>()
                .eq(VoyageStockDetailDO::getVoyageId, voyageId)
                .orderByAsc(VoyageStockDetailDO::getRoomModelId)
                .orderByAsc(VoyageStockDetailDO::getFloor));
    }

    @TenantIgnore
    default void deleteByVoyageId(Long voyageId) {
        delete(new LambdaQueryWrapperX<VoyageStockDetailDO>()
                .eq(VoyageStockDetailDO::getVoyageId, voyageId));
    }

    @TenantIgnore
    default void deleteByVoyageIds(List<Long> voyageIds) {
        delete(new LambdaQueryWrapperX<VoyageStockDetailDO>()
                .in(VoyageStockDetailDO::getVoyageId, voyageIds));
    }
}