<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.bonus.canteen.core.menu.mapper.MenuPackageDishesMapper">

    <!-- 批量插入数据 -->
    <insert id="insertBatch" parameterType="List">
        insert into
        menu_package_dishes (dishes_id, package_id, proportion, crby)
        values
        <foreach collection="packageDishesList" item="packageDishesList" separator="," close=";">
            (#{packageDishesList.dishesId}, #{packageDishesList.packageId},
            #{packageDishesList.proportion}, #{packageDishesList.crby})
        </foreach>
    </insert>

    <select id="selectPackageDishes" resultType="com.bonus.canteen.core.menu.dto.MenuAppPackageDishesPageVO">
        select
            md.dishes_id,
            md.dishes_name,
            mpd.proportion
        from
            menu_package_dishes mpd
                left join menu_dishes md on mpd.dishes_id = md.dishes_id
        where
            md.del_flag = 2
            and mpd.package_id = #{dishesId}
    </select>
</mapper>
