package com.bonus.canteen.core.menu.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.menu.entity.MenuDishesSuit;
import com.bonus.canteen.core.menu.entity.MenuSuitDishes;
import com.bonus.canteen.core.menu.vo.MenuDishesSuitPageVO;
import com.bonus.canteen.core.menu.vo.MenuSuitDishesPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuDishesSuitMapper extends BaseMapper<MenuDishesSuit> {
   @Select({"select suit_id,suit_name,crby,crtime,upby,uptime from menu_dishes_suit ${ew.customSqlSegment}"})
   Page<MenuDishesSuitPageVO> selectSuitPage(Page<MenuDishesSuitPageVO> page, @Param("ew") LambdaQueryWrapper<MenuDishesSuit> queryWrapper);

   @Select({"select mds.suit_id,mds.suit_name from menu_dishes_suit mds left join menu_suit_dishes msd on msd.suit_id = mds.suit_id where msd.dishes_id = #{dishesId} and msd.del_flag = #{delFlag}"})
   List<MenuSuitDishesPageVO> selectListByDishesId(MenuSuitDishes tasteDishes);

   @Select({"select suit_id from menu_suit_dishes where del_flag = 2 and dishes_id = #{dishesId}"})
   List<Long> selectSuitByDishesId(@Param("dishesId") Long dishesId);
}
