You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.5 KiB
112 lines
3.5 KiB
<?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">
|
|
|
|
<select id="list" resultType="com.sky.entity.Setmeal">
|
|
select * from setmeal
|
|
<where>
|
|
<if test="name != null">
|
|
name like concat('%',#{name},'%')
|
|
</if>
|
|
<if test="categoryId != null">
|
|
and category_id = #{categoryId}
|
|
</if>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="countByMap" resultType="java.lang.Integer">
|
|
select count(id) from setmeal
|
|
<where>
|
|
<if test="status != null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="categoryId != null">
|
|
and category_id = #{categoryId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="pageQuery" resultType="com.sky.entity.Setmeal">
|
|
select * from setmeal
|
|
<where>
|
|
<if test="name !=null and name!=''">
|
|
name=#{name},
|
|
</if>
|
|
<if test="categoryId!=null">
|
|
category_id=#{categoryId},
|
|
</if>
|
|
<if test="status!=null">
|
|
status=#{status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="updateSetmeal">
|
|
update setmeal
|
|
<set>
|
|
<if test="name!=null and name!=''">
|
|
name=#{name},
|
|
</if>
|
|
<if test="price!=null">
|
|
price=#{price},
|
|
</if>
|
|
<if test="categoryId!=null">
|
|
category_id=#{categoryId},
|
|
</if>
|
|
<if test="image!=null">
|
|
image=#{image},
|
|
</if>
|
|
<if test="description!=null and description!=''">
|
|
description=#{description},
|
|
</if>
|
|
<if test="createTime!=null">
|
|
create_time=#{createTime},
|
|
</if>
|
|
<if test="createUser!=null">
|
|
create_user=#{createUser},
|
|
</if>
|
|
<if test="updateTime!=null">
|
|
update_time=#{updateTime},
|
|
</if>
|
|
<if test="updateUser!=null">
|
|
update_user=#{updateUser},
|
|
</if>
|
|
<if test="status!=null">
|
|
status=#{status}
|
|
</if>
|
|
</set>
|
|
where id=#{id}
|
|
</update>
|
|
|
|
<insert id="insertBatchSetmealDish">
|
|
insert into setmeal_dish(name,price,copies,setmeal_id,dish_id)
|
|
values
|
|
<foreach collection="setmealDishes" separator="," item="setmealDish">
|
|
(#{setmealDish.name},#{setmealDish.price},#{setmealDish.copies},#{setmealDish.setmealId},#{setmealDish.dishId})
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
<delete id="batchDeleteSetmeal">
|
|
delete from setmeal
|
|
where
|
|
id in
|
|
<foreach collection="ids" item="id" close=")" open="(" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
|
|
|
|
</delete>
|
|
|
|
<insert id="insertSetmeal">
|
|
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>
|
|
|
|
</mapper>
|