外卖项目day03-菜品分页查询-需求分析和设计-功能实现

This commit is contained in:
xx
2026-11-21 11:05:33 +08:00
parent 2e4d08d0dc
commit f871774096
5 changed files with 69 additions and 4 deletions
@@ -7,4 +7,19 @@
insert into dish (name, category_id, price, image, description, create_time, update_time, create_user, update_user,status)
values (#{name},#{categoryId},#{price},#{image},#{description},#{createTime},#{updateTime},#{createUser},#{updateUser},#{status})
</insert>
<select id="pageQuery" resultType="com.sky.vo.DishVO">
select d.*,c.name as categoryName from dish d left join category c on d.category_id = c.id
<where>
<if test="name != null and name != ''">
and d.name like concat('%',#{name},'%')
</if>
<if test="categoryId != null">
and d.category_id = #{categoryId}
</if>
<if test="status != null">
and d.status = #{status}
</if>
</where>
order by d.create_time desc
</select>
</mapper>