商品更新接口
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.product.dao.ProductSkuMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, spu_id, status, pic_url, attrs,
|
||||
price, quantity, create_time
|
||||
</sql>
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="ProductSkuDO">
|
||||
SELECT
|
||||
id
|
||||
<include refid="FIELDS" />
|
||||
FROM product_sku
|
||||
WHERE id = #{id}
|
||||
AND delete = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertList" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
@@ -21,4 +27,50 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectListBySpuIdAndStatus" resultType="ProductSkuDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_sku
|
||||
WHERE spu_id = #{spuId}
|
||||
AND status = #{status}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="ProductSpuDO">
|
||||
UPDATE product_sku
|
||||
<set>
|
||||
<if test="spuId != null">
|
||||
spu_id = #{spuId},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="picUrl != null">
|
||||
pic_url = #{picUrl},
|
||||
</if>
|
||||
<if test="attrs != null">
|
||||
attrs = #{attrs},
|
||||
</if>
|
||||
<if test="price != null">
|
||||
price = #{price},
|
||||
</if>
|
||||
<if test="quantity != null">
|
||||
quantity = #{quantity},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted}
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateToDeleted" parameterType="Integer">
|
||||
UPDATE product_sku
|
||||
SET deleted = 1
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="ids" separator="," open="(" close=")" index="">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -19,8 +19,35 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
|
||||
<update id="update" parameterType="ProductSpuDO">
|
||||
UPDATE product_spu
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="sellPoint != null">
|
||||
sell_point = #{sellPoint},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="cid != null">
|
||||
cid = #{cid},
|
||||
</if>
|
||||
<if test="picUrls != null">
|
||||
pic_urls = #{picUrls},
|
||||
</if>
|
||||
<if test="visible != null">
|
||||
visible = #{visible},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted}
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user