package com.bonus.core.menu.mapper;

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

import java.util.Collection;

@Mapper
public interface MenuRecipeDishesMapper extends BaseMapper<MenuRecipeDishes> {
   Integer insertValues(Collection<MenuRecipeDishes> list);

   @Update({"update menu_recipe_dishes set sale_num = sale_num + #{saleNum}, surplus_num = surplus_num - #{saleNum} where id = #{id}"})
   void updateNumById(@Param("id") Long id, @Param("saleNum") Integer saleNum);

}
