298 lines
11 KiB
XML
298 lines
11 KiB
XML
|
<?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.zhwl.wcsc.mapper.ZdyWcscCartMapper">
|
||
|
|
||
|
<resultMap type="ZdyWcscCart" id="ZdyWcscCartResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="userId" column="user_id"/>
|
||
|
<result property="goodsId" column="goods_id"/>
|
||
|
<result property="storeId" column="store_id"/>
|
||
|
<result property="tempId" column="temp_id"/>
|
||
|
<result property="goodsNum" column="goods_num"/>
|
||
|
<result property="skuPriceId" column="sku_price_id"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="updateTime" column="update_time"/>
|
||
|
<result property="deletetime" column="deletetime"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="updateBy" column="update_by"/>
|
||
|
<association property="goods" javaType="ZdyWcscGoods" resultMap="goodsResult"/>
|
||
|
<association property="sku" javaType="ZdyWcscGoodsSkuPrice" resultMap="skuPriceResult"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<resultMap type="ZdyWcscGoods" id="goodsResult">
|
||
|
<result property="id" column="goods_id"/>
|
||
|
<result property="type" column="type"/>
|
||
|
<result property="title" column="title"/>
|
||
|
<result property="subtitle" column="subtitle"/>
|
||
|
<result property="status" column="status"/>
|
||
|
<result property="weigh" column="weigh"/>
|
||
|
<result property="categoryIds" column="category_ids"/>
|
||
|
<result property="image" column="image"/>
|
||
|
<result property="images" column="images"/>
|
||
|
<result property="params" column="params"/>
|
||
|
<result property="content" column="content"/>
|
||
|
<result property="price" column="price"/>
|
||
|
<result property="originalPrice" column="original_price"/>
|
||
|
<result property="isSku" column="is_sku"/>
|
||
|
<result property="likes" column="likes"/>
|
||
|
<result property="views" column="views"/>
|
||
|
<result property="sales" column="sales"/>
|
||
|
<result property="showSales" column="show_sales"/>
|
||
|
<result property="serviceIds" column="service_ids"/>
|
||
|
<result property="dispatchType" column="dispatch_type"/>
|
||
|
<result property="dispatchIds" column="dispatch_ids"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="updateTime" column="update_time"/>
|
||
|
<result property="deletetime" column="deletetime"/>
|
||
|
<result property="score" column="score"/>
|
||
|
<result property="adminId" column="admin_id"/>
|
||
|
<result property="checkUid" column="check_uid"/>
|
||
|
<result property="checkStatus" column="check_status"/>
|
||
|
<result property="checkRemark" column="check_remark"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="updateBy" column="update_by"/>
|
||
|
<result property="stock" column="stock"/>
|
||
|
<result property="storeId" column="store_id"/>
|
||
|
<result property="storeName" column="storeName"/>
|
||
|
<result property="storeImage" column="storeImage"/>
|
||
|
<result property="dispatchName" column="dispatchName"/>
|
||
|
<result property="flag" column="flag"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<resultMap type="ZdyWcscGoodsSkuPrice" id="skuPriceResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="goodsSkuIds" column="goods_sku_ids"/>
|
||
|
<result property="goodsId" column="goods_id"/>
|
||
|
<result property="weigh" column="weigh"/>
|
||
|
<result property="image" column="image"/>
|
||
|
<result property="stock" column="stock"/>
|
||
|
<result property="sales" column="sales"/>
|
||
|
<result property="sn" column="sn"/>
|
||
|
<result property="weight" column="weight"/>
|
||
|
<result property="price" column="price"/>
|
||
|
<result property="goodsSkuText" column="goods_sku_text"/>
|
||
|
<result property="status" column="status"/>
|
||
|
</resultMap>
|
||
|
|
||
|
|
||
|
<sql id="selectZdyWcscCartVo">
|
||
|
select cart.id,
|
||
|
cart.user_id,
|
||
|
cart.goods_id,
|
||
|
cart.goods_num,
|
||
|
cart.sku_price_id,
|
||
|
cart.temp_id,
|
||
|
goods.store_id as storeId,
|
||
|
goods.type,
|
||
|
goods.title,
|
||
|
goods.subtitle,
|
||
|
goods.STATUS,
|
||
|
goods.weigh,
|
||
|
goods.category_ids,
|
||
|
goods.image,
|
||
|
goods.images,
|
||
|
goods.params,
|
||
|
goods.content,
|
||
|
goods.price,
|
||
|
goods.original_price,
|
||
|
goods.is_sku,
|
||
|
goods.likes,
|
||
|
goods.views,
|
||
|
goods.sales,
|
||
|
goods.show_sales,
|
||
|
goods.service_ids,
|
||
|
goods.dispatch_type,
|
||
|
goods.dispatch_ids,
|
||
|
goods.score,
|
||
|
goods.admin_id,
|
||
|
goods.check_uid,
|
||
|
goods.check_status,
|
||
|
goods.check_remark,
|
||
|
goods.store_id,
|
||
|
goods.flag,
|
||
|
skuPrice.goods_sku_ids,
|
||
|
skuPrice.weigh,
|
||
|
skuPrice.image,
|
||
|
skuPrice.stock,
|
||
|
skuPrice.sales,
|
||
|
skuPrice.sn,
|
||
|
skuPrice.weight,
|
||
|
skuPrice.price,
|
||
|
skuPrice.goods_sku_text,
|
||
|
skuPrice.status
|
||
|
from zdy_wcsc_cart cart
|
||
|
LEFT JOIN zdy_wcsc_goods goods on goods.id = cart.goods_id
|
||
|
LEFT JOIN zdy_wcsc_goods_sku_price skuPrice on skuPrice.goods_id = cart.goods_id
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyWcscCartList" parameterType="ZdyWcscCart" resultMap="ZdyWcscCartResult">
|
||
|
<include refid="selectZdyWcscCartVo"/>
|
||
|
<where>
|
||
|
ISNULL(cart.deletetime)
|
||
|
<if test="userId != null ">
|
||
|
and cart.user_id = #{userId}
|
||
|
</if>
|
||
|
<if test="goodsId != null ">
|
||
|
and cart.goods_id = #{goodsId}
|
||
|
</if>
|
||
|
<if test="tempId != null ">
|
||
|
and cart.temp_id = #{tempId}
|
||
|
</if>
|
||
|
<if test="goodsNum != null ">
|
||
|
and cart.goods_num = #{goodsNum}
|
||
|
</if>
|
||
|
<if test="skuPriceId != null ">
|
||
|
and cart.sku_price_id = #{skuPriceId}
|
||
|
</if>
|
||
|
<if test="createBy != null ">
|
||
|
and cart.create_by = #{createBy}
|
||
|
</if>
|
||
|
<if test="createTime != null ">
|
||
|
and cart.create_time = #{createTime}
|
||
|
</if>
|
||
|
<if test="updateTime != null ">
|
||
|
and cart.update_time = #{updateTime}
|
||
|
</if>
|
||
|
<if test="deletetime != null ">
|
||
|
and cart.deletetime = #{deletetime}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyWcscCartById" parameterType="Long"
|
||
|
resultMap="ZdyWcscCartResult">
|
||
|
<include refid="selectZdyWcscCartVo"/>
|
||
|
where cart.id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyWcscCart" parameterType="ZdyWcscCart" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_wcsc_cart
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="userId != null">user_id,
|
||
|
</if>
|
||
|
<if test="goodsId != null">goods_id,
|
||
|
</if>
|
||
|
<if test="tempId != null">temp_id,
|
||
|
</if>
|
||
|
<if test="goodsNum != null">goods_num,
|
||
|
</if>
|
||
|
<if test="skuPriceId != null">sku_price_id,
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time,
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time,
|
||
|
</if>
|
||
|
<if test="deletetime != null">deletetime,
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by,
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="userId != null">#{userId},
|
||
|
</if>
|
||
|
<if test="goodsId != null">#{goodsId},
|
||
|
</if>
|
||
|
<if test="tempId != null">#{tempId},
|
||
|
</if>
|
||
|
<if test="goodsNum != null">#{goodsNum},
|
||
|
</if>
|
||
|
<if test="skuPriceId != null">#{skuPriceId},
|
||
|
</if>
|
||
|
<if test="createTime != null">#{createTime},
|
||
|
</if>
|
||
|
<if test="updateTime != null">#{updateTime},
|
||
|
</if>
|
||
|
<if test="deletetime != null">#{deletetime},
|
||
|
</if>
|
||
|
<if test="createBy != null">#{createBy},
|
||
|
</if>
|
||
|
<if test="updateBy != null">#{updateBy},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyWcscCart" parameterType="ZdyWcscCart">
|
||
|
update zdy_wcsc_cart
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="userId != null">user_id =
|
||
|
#{userId},
|
||
|
</if>
|
||
|
<if test="goodsId != null">goods_id =
|
||
|
#{goodsId},
|
||
|
</if>
|
||
|
<if test="tempId != null">temp_id =
|
||
|
#{tempId},
|
||
|
</if>
|
||
|
<if test="goodsNum != null">goods_num =
|
||
|
#{goodsNum},
|
||
|
</if>
|
||
|
<if test="skuPriceId != null">sku_price_id =
|
||
|
#{skuPriceId},
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time =
|
||
|
#{createTime},
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time =
|
||
|
#{updateTime},
|
||
|
</if>
|
||
|
<if test="deletetime != null">deletetime =
|
||
|
#{deletetime},
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by =
|
||
|
#{createBy},
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by =
|
||
|
#{updateBy},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyWcscCartById" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_wcsc_cart
|
||
|
where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyWcscCartByGoodId" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_wcsc_cart
|
||
|
where goods_id = #{goodsId}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyWcscCartByIds" parameterType="String">
|
||
|
delete from zdy_wcsc_cart where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
<delete id="deleteZdyWcscCartByIdsAndUserId" >
|
||
|
delete from zdy_wcsc_cart where user_id = #{userId}
|
||
|
<if test="ids != null">
|
||
|
and id in
|
||
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</delete>
|
||
|
|
||
|
<select id="queryCartByPriceId" resultMap="ZdyWcscCartResult">
|
||
|
select *
|
||
|
from zdy_wcsc_cart
|
||
|
where user_id = #{userId}
|
||
|
and sku_price_id = #{skuPriceId} limit 1
|
||
|
</select>
|
||
|
|
||
|
<select id="queryTempIdMaxNum" >
|
||
|
select ifnull(max(temp_id),0)
|
||
|
from zdy_wcsc_cart
|
||
|
</select>
|
||
|
|
||
|
|
||
|
</mapper>
|