package com.bonus.core.menu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.core.menu.entity.MenuRecipeDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

@Mapper
public interface MenuRecipeDetailMapper extends BaseMapper<MenuRecipeDetail> {
    @Select({"select count(1) from menu_recipe_detail mrd inner join menu_recipe_dishes mrdd on mrd.detail_id = mrdd.detail_id where mrd.detail_id = #{detailId} and mrdd.dishes_id = #{productId} and mrd.apply_date = #{applyDate} and mrd.mealtime_type = #{mealtimeType}"})
    Integer selectDishesCount(@Param("detailId") Long detailId, @Param("productId") Long productId, @Param("applyDate") LocalDate applyDate, @Param("mealtimeType") Integer mealtimeType);

}
