<?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.MenuDishesTasteMapper">

    <!-- 根据菜品id获取菜品口味 -->
    <select id="selectListByDishesId" resultType="com.bonus.canteen.core.menu.vo.MenuTasteDishesPageVO">
        select mdt.taste_id   tasteId,
               mdt.taste_name tasteName
        from menu_dishes_taste mdt
                 left join menu_taste_dishes mtd on mdt.taste_id = mtd.taste_id
        where mdt.del_flag = #{delFlag}
          and mtd.dishes_id = #{dishesId}
    </select>

    <!-- 分页获取口味信息列表 -->
    <select id="selectAllList" resultType="com.bonus.canteen.core.menu.vo.MenuDishesTastePageVO">
        select
            taste_id tasteId,
            taste_name tasteName,
            crby,
            crtime,
            upby,
            uptime
        from
            menu_dishes_taste
        where
            del_flag = #{delFlag}
        <if test="dishesTastePageDTO.tasteId != null">
            and taste_id = #{dishesTastePageDTO.tasteId}
        </if>
        <if test="dishesTastePageDTO.tasteName != null and dishesTastePageDTO.tasteName != ''">
            and taste_name like #{dishesTastePageDTO.tasteName}
        </if>
        order by
        id desc
    </select>
</mapper>
