updatePrice.md 6.63 KB

单个商品变价

接口名: '/product/updateProductPrice'

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
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代表成功 )

{
  "code": 200,
  "data": [],
  "md5": "d751713988987e9331980363e24189ce",
  "message": "Product Price update success."
}