<?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.marketing.mapper.MktEffectiveDetailMapper">

    <!-- 批量插入 -->
    <insert id="insertBatch">
        insert into mkt_effective_detail (eff_id, org_id, psn_type, canteen_id,
        shopstall_id, dishes_id, package_id, product_id,warehouse_id)
        values
        <foreach collection="effectiveDetailList" item="item" index="index" separator=",">
            (#{item.effId}, #{item.orgId}, #{item.psnType}, #{item.canteenId},
            #{item.shopstallId}, #{item.dishesId}, #{item.packageId}, #{item.productId},#{item.warehouseId})
        </foreach>
    </insert>

    <!-- 根据范围id获取食堂档口详情 -->
    <select id="selectCanteenList" resultType="com.bonus.canteen.core.marketing.vo.MktEffectiveCanteenPageVO">
        select med.canteen_id   canteenId,
               bd.dining_name   diningName,
               med.shopstall_id shopstallId,
               bs.stname
        from mkt_effective_detail med
                 left join basics_dining bd on med.canteen_id = bd.dining_id
                 left join basics_shopstalls bs on med.shopstall_id = bs.shopstall_id
        where med.eff_id = #{effId}
    </select>

</mapper>
