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.
50 lines
1.7 KiB
50 lines
1.7 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.ShoppingCartMapper">
|
|
<delete id="delete" parameterType="com.sky.entity.ShoppingCart">
|
|
delete from shopping_cart
|
|
<where>
|
|
<if test="userId!=null">
|
|
user_id=#{userId}
|
|
</if>
|
|
<if test="dishId!=null">
|
|
and dish_id=#{dishId}
|
|
</if>
|
|
<if test="dishFlavor!=null">
|
|
and dish_flavor=#{dishFlavor}
|
|
</if>
|
|
<if test="setmealId!=null">
|
|
and setmeal_id=#{setmealId}
|
|
</if>
|
|
</where>
|
|
|
|
</delete>
|
|
<insert id="insertBatch" parameterType="list">
|
|
insert into shopping_cart
|
|
(name, image, user_id, dish_id, setmeal_id, dish_flavor, number, amount, create_time)
|
|
values
|
|
<foreach collection="shoppingCartList" item="sc" separator=",">
|
|
(#{sc.name},#{sc.image},#{sc.userId},#{sc.dishId},#{sc.setmealId},#{sc.dishFlavor},#{sc.number},#{sc.amount},#{sc.createTime})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="list" resultType="com.sky.entity.ShoppingCart">
|
|
select * from shopping_cart
|
|
<where>
|
|
<if test="userId!=null">
|
|
user_id=#{userId}
|
|
</if>
|
|
<if test="dishId!=null">
|
|
and dish_id=#{dishId}
|
|
</if>
|
|
<if test="setmealId!=null">
|
|
and setmeal_id=#{setmealId}
|
|
</if>
|
|
<if test="dishFlavor!=null">
|
|
and dish_flavor=#{dishFlavor}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper> |