123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?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.fs.live.mapper.LiveCartMapper">
- <resultMap type="LiveCart" id="LiveCartResult">
- <result property="cardId" column="card_id" />
- <result property="liveId" column="live_id" />
- <result property="userId" column="user_id" />
- <result property="goodsId" column="goods_id" />
- <result property="productId" column="product_id" />
- <result property="productAttrValueId" column="product_attr_value_id" />
- <result property="cartNum" column="cart_num" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="isPay" column="is_pay" />
- <result property="isDel" column="is_del" />
- <result property="isBuy" column="is_buy" />
- </resultMap>
- <sql id="selectLiveCartVo">
- select card_id, live_id, user_id, goods_id, product_id, product_attr_value_id, cart_num, create_time, update_time, is_pay, is_del, is_buy from live_cart
- </sql>
- <select id="selectLiveCartList" parameterType="LiveCart" resultMap="LiveCartResult">
- <include refid="selectLiveCartVo"/>
- <where>
- <if test="liveId != null "> and live_id = #{liveId}</if>
- <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
- <if test="goodsId != null "> and goods_id = #{goodsId}</if>
- <if test="productId != null and productId != ''"> and product_id = #{productId}</if>
- <if test="productAttrValueId != null "> and product_attr_value_id = #{productAttrValueId}</if>
- <if test="cartNum != null and cartNum != ''"> and cart_num = #{cartNum}</if>
- <if test="isPay != null "> and is_pay = #{isPay}</if>
- <if test="isDel != null "> and is_del = #{isDel}</if>
- <if test="isBuy != null "> and is_buy = #{isBuy}</if>
- </where>
- </select>
- <select id="selectLiveCartByCardId" parameterType="Long" resultMap="LiveCartResult">
- <include refid="selectLiveCartVo"/>
- where card_id = #{cardId}
- </select>
- <insert id="insertLiveCart" parameterType="LiveCart" useGeneratedKeys="true" keyProperty="cardId">
- insert into live_cart
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="liveId != null">live_id,</if>
- <if test="userId != null and userId != ''">user_id,</if>
- <if test="goodsId != null">goods_id,</if>
- <if test="productId != null and productId != ''">product_id,</if>
- <if test="productAttrValueId != null">product_attr_value_id,</if>
- <if test="cartNum != null and cartNum != ''">cart_num,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="isPay != null">is_pay,</if>
- <if test="isDel != null">is_del,</if>
- <if test="isBuy != null">is_buy,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="liveId != null">#{liveId},</if>
- <if test="userId != null and userId != ''">#{userId},</if>
- <if test="goodsId != null">#{goodsId},</if>
- <if test="productId != null and productId != ''">#{productId},</if>
- <if test="productAttrValueId != null">#{productAttrValueId},</if>
- <if test="cartNum != null and cartNum != ''">#{cartNum},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="isPay != null">#{isPay},</if>
- <if test="isDel != null">#{isDel},</if>
- <if test="isBuy != null">#{isBuy},</if>
- </trim>
- </insert>
- <update id="updateLiveCart" parameterType="LiveCart">
- update live_cart
- <trim prefix="SET" suffixOverrides=",">
- <if test="liveId != null">live_id = #{liveId},</if>
- <if test="userId != null and userId != ''">user_id = #{userId},</if>
- <if test="goodsId != null">goods_id = #{goodsId},</if>
- <if test="productId != null and productId != ''">product_id = #{productId},</if>
- <if test="productAttrValueId != null">product_attr_value_id = #{productAttrValueId},</if>
- <if test="cartNum != null and cartNum != ''">cart_num = #{cartNum},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="isPay != null">is_pay = #{isPay},</if>
- <if test="isDel != null">is_del = #{isDel},</if>
- <if test="isBuy != null">is_buy = #{isBuy},</if>
- </trim>
- where card_id = #{cardId}
- </update>
- <delete id="deleteLiveCartByCardId" parameterType="Long">
- delete from live_cart where card_id = #{cardId}
- </delete>
- <delete id="deleteLiveCartByCardIds" parameterType="String">
- delete from live_cart where card_id in
- <foreach item="cardId" collection="array" open="(" separator="," close=")">
- #{cardId}
- </foreach>
- </delete>
- </mapper>
|