2024-01-06 14:34:19 +08:00
|
|
|
<?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.sky.mapper.SetmealMapper">
|
|
|
|
|
|
|
|
<!-- 根据分类id查询套餐的数量 -->
|
|
|
|
<select id="countByCategoryId" resultType="java.lang.Integer">
|
|
|
|
select count(id)
|
|
|
|
from setmeal
|
|
|
|
where category_id = #{categoryId}
|
|
|
|
</select>
|
2024-01-08 16:56:43 +08:00
|
|
|
|
|
|
|
<!-- 动态条件查询套餐 -->
|
|
|
|
<select id="list" parameterType="Setmeal" resultType="Setmeal">
|
|
|
|
select * from setmeal
|
|
|
|
<where>
|
|
|
|
<if test="name != null">
|
|
|
|
and name like concat('%',#{name},'%')
|
|
|
|
</if>
|
|
|
|
<if test="categoryId != null">
|
|
|
|
and category_id = #{categoryId}
|
|
|
|
</if>
|
|
|
|
<if test="status != null">
|
|
|
|
and status = #{status}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据套餐id查询菜品选项 -->
|
|
|
|
<select id="getDishItemBySetmealId" resultType="com.sky.vo.DishItemVO">
|
|
|
|
select sd.name, sd.copies, d.image, d.description
|
|
|
|
from setmeal_dish sd
|
|
|
|
left join dish d on sd.dish_id = d.id
|
|
|
|
where sd.setmeal_id = #{setmealId}
|
|
|
|
</select>
|
2024-01-06 14:34:19 +08:00
|
|
|
</mapper>
|