<?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.ltkj.mall.mapper.MallCartMapper">
|
|
<resultMap type="MallCart" id="MallCartResult">
|
<result property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="goodsId" column="goods_id"/>
|
<result property="goodsSn" column="goods_sn"/>
|
<result property="goodsName" column="goods_name"/>
|
<result property="productId" column="product_id"/>
|
<result property="price" column="price"/>
|
<result property="number" column="number"/>
|
<result property="specifications" column="specifications"/>
|
<result property="checked" column="checked"/>
|
<result property="picUrl" column="pic_url"/>
|
<result property="deptId" column="dept_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="createBy" column="create_by"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="deleted" column="deleted"/>
|
</resultMap>
|
|
<sql id="selectMallCartVo">
|
select id,
|
user_id,
|
goods_id,
|
goods_sn,
|
goods_name,
|
product_id,
|
price,
|
number,
|
specifications,
|
checked,
|
pic_url,
|
dept_id,
|
create_time,
|
create_by,
|
update_time,
|
update_by,
|
deleted
|
from mall_cart
|
</sql>
|
|
<select id="selectMallCartList" parameterType="MallCart" resultMap="MallCartResult">
|
<include refid="selectMallCartVo"/>
|
<where>
|
|
<if test="startTime != null and endTime !=null ">
|
and create_time between #{startTime} and #{endTime}
|
</if>
|
|
<if test="goodsName != null and goodsName != ''">
|
and goods_name like concat('%', #{goodsName}, '%')
|
</if>
|
<if test="userId != null and userId != ''">
|
and user_id = #{userId}
|
</if>
|
|
<if test="phone != null and phone != ''">
|
and user_id = (SELECT a.id FROM wxuser a WHERE a.phone=#{phone})
|
</if>
|
</where>
|
</select>
|
|
<select id="selectMallCartById" parameterType="Long"
|
resultMap="MallCartResult">
|
<include refid="selectMallCartVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertMallCart" parameterType="MallCart" useGeneratedKeys="true"
|
keyProperty="id">
|
insert into mall_cart
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="userId != null">user_id,
|
</if>
|
<if test="goodsId != null">goods_id,
|
</if>
|
<if test="goodsSn != null">goods_sn,
|
</if>
|
<if test="goodsName != null">goods_name,
|
</if>
|
<if test="productId != null">product_id,
|
</if>
|
<if test="price != null">price,
|
</if>
|
<if test="number != null">number,
|
</if>
|
<if test="specifications != null">specifications,
|
</if>
|
<if test="checked != null">checked,
|
</if>
|
<if test="picUrl != null">pic_url,
|
</if>
|
<if test="deptId != null">dept_id,
|
</if>
|
<if test="createTime != null">create_time,
|
</if>
|
<if test="createBy != null">create_by,
|
</if>
|
<if test="updateTime != null">update_time,
|
</if>
|
<if test="updateBy != null">update_by,
|
</if>
|
<if test="deleted != null">deleted,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="userId != null">#{userId},
|
</if>
|
<if test="goodsId != null">#{goodsId},
|
</if>
|
<if test="goodsSn != null">#{goodsSn},
|
</if>
|
<if test="goodsName != null">#{goodsName},
|
</if>
|
<if test="productId != null">#{productId},
|
</if>
|
<if test="price != null">#{price},
|
</if>
|
<if test="number != null">#{number},
|
</if>
|
<if test="specifications != null">#{specifications},
|
</if>
|
<if test="checked != null">#{checked},
|
</if>
|
<if test="picUrl != null">#{picUrl},
|
</if>
|
<if test="deptId != null">#{deptId},
|
</if>
|
<if test="createTime != null">#{createTime},
|
</if>
|
<if test="createBy != null">#{createBy},
|
</if>
|
<if test="updateTime != null">#{updateTime},
|
</if>
|
<if test="updateBy != null">#{updateBy},
|
</if>
|
<if test="deleted != null">#{deleted},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="updateMallCart" parameterType="MallCart">
|
update mall_cart
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="userId != null">user_id =
|
#{userId},
|
</if>
|
<if test="goodsId != null">goods_id =
|
#{goodsId},
|
</if>
|
<if test="goodsSn != null">goods_sn =
|
#{goodsSn},
|
</if>
|
<if test="goodsName != null">goods_name =
|
#{goodsName},
|
</if>
|
<if test="productId != null">product_id =
|
#{productId},
|
</if>
|
<if test="price != null">price =
|
#{price},
|
</if>
|
<if test="number != null">number =
|
#{number},
|
</if>
|
<if test="specifications != null">specifications =
|
#{specifications},
|
</if>
|
<if test="checked != null">checked =
|
#{checked},
|
</if>
|
<if test="picUrl != null">pic_url =
|
#{picUrl},
|
</if>
|
<if test="deptId != null">dept_id =
|
#{deptId},
|
</if>
|
<if test="createTime != null">create_time =
|
#{createTime},
|
</if>
|
<if test="createBy != null">create_by =
|
#{createBy},
|
</if>
|
<if test="updateTime != null">update_time =
|
#{updateTime},
|
</if>
|
<if test="updateBy != null">update_by =
|
#{updateBy},
|
</if>
|
<if test="deleted != null">deleted =
|
#{deleted},
|
</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteMallCartById" parameterType="Long">
|
delete
|
from mall_cart
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteMallCartByIds" parameterType="String">
|
delete from mall_cart where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|