batchUpdatePrice.md
7.06 KB
批量商品变价
接口名: '/product/batchUpdateProductPrice'
方法
POST JSONRAW
入参 例子:
{"batchList" : [{"product_skn":50000055,"retail_price":29,"return_coin":2,"sales_price":19,"vip1_price":18.05,"vip2_price":17.1,"vip3_price":16.72,"vip_discount_type":1,"vip_price":19}, {"product_skn":50000082,"retail_price":298,"return_coin":1,"sales_price":22,"vip1_price":260,"vip2_price":260,"vip3_price":260,"vip_discount_type":4,"vip_price":260}]}
属性名称 | 类型 | 例子 | 说明 | 是否必填 | 长度限制 |
---|---|---|---|---|---|
product_skn | number | 5000060 | 商品的Skn | Y | 11 |
sales_price | float | 22.22 | 销售价格 | Y | 11 |
vip_discount_type | number | 1到5 | 折扣类型 | Y | 1 |
return_coin | number | 200 | 返回币数 | N | 5 |
vip_price | float | 22.33 | vip价格 vipDiscountType 为4时必填 | N | 11 |
vip1_price | float | 22.33 | 折扣类型为5时必填 | N | 11 |
vip2_price | float | 22.33 | 折扣类型为5时必填 | N | 11 |
vip3_price | float | 22.33 | 折扣类型为5时必填 | N | 11 |
对应SQL的操作库表
<update id="updateBatchByPrimaryKeySelective" parameterType="java.util.List">
update product_price
<trim prefix="set" suffixOverrides=",">
<trim prefix="sales_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.salesPrice!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.salesPrice,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="vip_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.vipPrice!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vipPrice,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="vip1_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.vip1Price!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip1Price,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="vip2_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.vip2Price!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip2Price,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="vip3_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.vip3Price!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip3Price,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="vip_discount_type =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.vipDiscountType!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vipDiscountType,jdbcType=TINYINT}
</if>
</foreach>
</trim>
<trim prefix="purchase_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.purchasePrice!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.purchasePrice,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="purchase_discount =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.purchaseDiscount!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.purchaseDiscount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="cost_price =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.costPrice!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.costPrice,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="return_coin =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.returnCoin!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.returnCoin,jdbcType=SMALLINT}
</if>
</foreach>
</trim>
<trim prefix="founder =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.founder!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.founder,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="create_time =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.createTime!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.createTime,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.updateTime!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.updateTime,jdbcType=INTEGER}
</if>
</foreach>
</trim>
<trim prefix="sys_status =case" suffix="end,">
<foreach collection="productPriceList" item="item" index="index">
<if test="item.sysStatus!=null">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.sysStatus,jdbcType=INTEGER}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="productPriceList" separator="or" item="item" index="index" >
product_skn= #{item.productSkn,jdbcType=INTEGER}
</foreach>
</update>
错误编码
错误码code | 消息 | 说明 |
---|---|---|
200 | 添加成功! | |
400 | 操作失败! | |
500 | 操作失败! |
返回 (备注 :code 为200代表成功 , data表示成功记录的表格所处相对路径)
{
"code": 200,
"data": "1455604702941.xlsx",
"md5": "d751713988987e9331980363e24189ce",
"message": "Product Price update success."
}