苍穹外卖--套餐管理--全部功能实现
This commit is contained in:
64
sky-server/src/main/resources/mapper/SetmealMapper.xml
Normal file
64
sky-server/src/main/resources/mapper/SetmealMapper.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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">
|
||||
<insert id="insert" parameterType="Setmeal" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into setmeal
|
||||
(category_id, name, price, status, description, image, create_time, update_time, create_user, update_user)
|
||||
values (#{categoryId}, #{name}, #{price}, #{status}, #{description}, #{image}, #{createTime}, #{updateTime},
|
||||
#{createUser}, #{updateUser})
|
||||
</insert>
|
||||
|
||||
<select id="pageQuery" resultType="com.sky.vo.SetmealVO">
|
||||
select
|
||||
s.*,c.name categoryName
|
||||
from
|
||||
setmeal s
|
||||
left join
|
||||
category c
|
||||
on
|
||||
s.category_id = c.id
|
||||
<where>
|
||||
<if test="name != null">
|
||||
and s.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and s.status = #{status}
|
||||
</if>
|
||||
<if test="categoryId != null">
|
||||
and s.category_id = #{categoryId}
|
||||
</if>
|
||||
</where>
|
||||
order by s.create_time desc
|
||||
</select>
|
||||
|
||||
<update id="update">
|
||||
update setmeal
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="categoryId != null">
|
||||
category_id = #{categoryId},
|
||||
</if>
|
||||
<if test="price != null">
|
||||
price = #{price},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="image != null">
|
||||
image = #{image},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="updateUser != null">
|
||||
update_user = #{updateUser}
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user