Authored by ZhongW

Update batchUpdatePrice.md

1 -## 批量商品变价  
2 -  
3 -> 接口名: '/product/batchUpdateProductPrice'  
4 -  
5 -### 方法  
6 -> POST JSONRAW  
7 -  
8 -### 入参 例子:  
9 -{"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},  
10 -{"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}]}  
11 -  
12 --------------------------  
13 -|属性名称|类型|例子|说明|是否必填|长度限制|  
14 -|--------|----|----|---|----|--------|  
15 -|product_skn|number|5000060|商品的Skn|Y|11  
16 -|sales_price|float|22.22|销售价格|Y|11|  
17 -|vip_discount_type|number|1到5|折扣类型|Y|1|  
18 -|return_coin|number|200|返回币数|N|5|  
19 -|vip_price|float|22.33|vip价格 vipDiscountType 为4时必填|N|11|  
20 -|vip1_price|float|22.33|折扣类型为5时必填|N|11|  
21 -|vip2_price|float|22.33|折扣类型为5时必填|N|11|  
22 -|vip3_price|float|22.33|折扣类型为5时必填|N|11|  
23 ----------------------  
24 -  
25 -  
26 -### 对应SQL的操作库表  
27 -  
28 -```xml  
29 - <update id="updateBatchByPrimaryKeySelective" parameterType="java.util.List">  
30 - update product_price  
31 - <trim prefix="set" suffixOverrides=",">  
32 - <trim prefix="sales_price =case" suffix="end,">  
33 - <foreach collection="productPriceList" item="item" index="index">  
34 - <if test="item.salesPrice!=null">  
35 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.salesPrice,jdbcType=DECIMAL}  
36 - </if>  
37 - </foreach>  
38 - </trim>  
39 - <trim prefix="vip_price =case" suffix="end,">  
40 - <foreach collection="productPriceList" item="item" index="index">  
41 - <if test="item.vipPrice!=null">  
42 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vipPrice,jdbcType=DECIMAL}  
43 - </if>  
44 - </foreach>  
45 - </trim>  
46 - <trim prefix="vip1_price =case" suffix="end,">  
47 - <foreach collection="productPriceList" item="item" index="index">  
48 - <if test="item.vip1Price!=null">  
49 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip1Price,jdbcType=DECIMAL}  
50 - </if>  
51 - </foreach>  
52 - </trim>  
53 - <trim prefix="vip2_price =case" suffix="end,">  
54 - <foreach collection="productPriceList" item="item" index="index">  
55 - <if test="item.vip2Price!=null">  
56 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip2Price,jdbcType=DECIMAL}  
57 - </if>  
58 - </foreach>  
59 - </trim>  
60 - <trim prefix="vip3_price =case" suffix="end,">  
61 - <foreach collection="productPriceList" item="item" index="index">  
62 - <if test="item.vip3Price!=null">  
63 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip3Price,jdbcType=DECIMAL}  
64 - </if>  
65 - </foreach>  
66 - </trim>  
67 - <trim prefix="vip_discount_type =case" suffix="end,">  
68 - <foreach collection="productPriceList" item="item" index="index">  
69 - <if test="item.vipDiscountType!=null">  
70 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vipDiscountType,jdbcType=TINYINT}  
71 - </if>  
72 - </foreach>  
73 - </trim>  
74 - <trim prefix="purchase_price =case" suffix="end,">  
75 - <foreach collection="productPriceList" item="item" index="index">  
76 - <if test="item.purchasePrice!=null">  
77 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.purchasePrice,jdbcType=DECIMAL}  
78 - </if>  
79 - </foreach>  
80 - </trim>  
81 - <trim prefix="purchase_discount =case" suffix="end,">  
82 - <foreach collection="productPriceList" item="item" index="index">  
83 - <if test="item.purchaseDiscount!=null">  
84 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.purchaseDiscount,jdbcType=DECIMAL}  
85 - </if>  
86 - </foreach>  
87 - </trim>  
88 - <trim prefix="cost_price =case" suffix="end,">  
89 - <foreach collection="productPriceList" item="item" index="index">  
90 - <if test="item.costPrice!=null">  
91 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.costPrice,jdbcType=DECIMAL}  
92 - </if>  
93 - </foreach>  
94 - </trim>  
95 - <trim prefix="return_coin =case" suffix="end,">  
96 - <foreach collection="productPriceList" item="item" index="index">  
97 - <if test="item.returnCoin!=null">  
98 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.returnCoin,jdbcType=SMALLINT}  
99 - </if>  
100 - </foreach>  
101 - </trim>  
102 - <trim prefix="founder =case" suffix="end,">  
103 - <foreach collection="productPriceList" item="item" index="index">  
104 - <if test="item.founder!=null">  
105 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.founder,jdbcType=INTEGER}  
106 - </if>  
107 - </foreach>  
108 - </trim>  
109 - <trim prefix="create_time =case" suffix="end,">  
110 - <foreach collection="productPriceList" item="item" index="index">  
111 - <if test="item.createTime!=null">  
112 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.createTime,jdbcType=INTEGER}  
113 - </if>  
114 - </foreach>  
115 - </trim>  
116 - <trim prefix="update_time =case" suffix="end,">  
117 - <foreach collection="productPriceList" item="item" index="index">  
118 - <if test="item.updateTime!=null">  
119 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.updateTime,jdbcType=INTEGER}  
120 - </if>  
121 - </foreach>  
122 - </trim>  
123 - <trim prefix="sys_status =case" suffix="end,">  
124 - <foreach collection="productPriceList" item="item" index="index">  
125 - <if test="item.sysStatus!=null">  
126 - when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.sysStatus,jdbcType=INTEGER}  
127 - </if>  
128 - </foreach>  
129 - </trim>  
130 - </trim>  
131 - where  
132 - <foreach collection="productPriceList" separator="or" item="item" index="index" >  
133 - product_skn= #{item.productSkn,jdbcType=INTEGER}  
134 - </foreach>  
135 -  
136 - </update>  
137 -```  
138 -  
139 -### 错误编码  
140 -  
141 --------------------------  
142 -|错误码code|消息|说明|  
143 -|--------|----|----|  
144 -|200| 添加成功!| |  
145 -|400| 操作失败!| |  
146 -|500| 操作失败!| |  
147 -  
148 -### 返回 (备注 :code 为200代表成功 , data表示成功记录的表格所处相对路径)  
149 -  
150 -``` json  
151 -{  
152 - "code": 200,  
153 - "data": "1455604702941.xlsx",  
154 - "md5": "d751713988987e9331980363e24189ce",  
155 - "message": "Product Price update success."  
156 -}  
157 - 1 +## 批量商品变价
  2 +
  3 +> 接口名: '/product/batchUpdateProductPrice'
  4 +
  5 +### 方法
  6 +> POST JSONRAW
  7 +
  8 +### 入参 例子:
  9 +{"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},
  10 +{"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}]}
  11 +
  12 +-------------------------
  13 +|属性名称|类型|例子|说明|是否必填|长度限制|
  14 +|--------|----|----|---|----|--------|
  15 +|product_skn|number|5000060|商品的Skn|Y|11
  16 +|sales_price|float|22.22|销售价格|Y|11|
  17 +|vip_discount_type|number|1到5|折扣类型|Y|1|
  18 +|return_coin|number|200|返回币数|N|5|
  19 +|vip_price|float|22.33|vip价格 vipDiscountType 为4时必填|N|11|
  20 +|vip1_price|float|22.33|折扣类型为5时必填|N|11|
  21 +|vip2_price|float|22.33|折扣类型为5时必填|N|11|
  22 +|vip3_price|float|22.33|折扣类型为5时必填|N|11|
  23 +|cgpriceStartTime|String|2016-06-01|变价开始日期|N||
  24 +|cgpriceEndTime|String|2016-06-20|变价结束日期|N||
  25 +---------------------
  26 +
  27 +
  28 +### 对应SQL的操作库表
  29 +
  30 +```xml
  31 + <update id="updateBatchByPrimaryKeySelective" parameterType="java.util.List">
  32 + update product_price
  33 + <trim prefix="set" suffixOverrides=",">
  34 + <trim prefix="sales_price =case" suffix="end,">
  35 + <foreach collection="productPriceList" item="item" index="index">
  36 + <if test="item.salesPrice!=null">
  37 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.salesPrice,jdbcType=DECIMAL}
  38 + </if>
  39 + </foreach>
  40 + </trim>
  41 + <trim prefix="vip_price =case" suffix="end,">
  42 + <foreach collection="productPriceList" item="item" index="index">
  43 + <if test="item.vipPrice!=null">
  44 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vipPrice,jdbcType=DECIMAL}
  45 + </if>
  46 + </foreach>
  47 + </trim>
  48 + <trim prefix="vip1_price =case" suffix="end,">
  49 + <foreach collection="productPriceList" item="item" index="index">
  50 + <if test="item.vip1Price!=null">
  51 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip1Price,jdbcType=DECIMAL}
  52 + </if>
  53 + </foreach>
  54 + </trim>
  55 + <trim prefix="vip2_price =case" suffix="end,">
  56 + <foreach collection="productPriceList" item="item" index="index">
  57 + <if test="item.vip2Price!=null">
  58 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip2Price,jdbcType=DECIMAL}
  59 + </if>
  60 + </foreach>
  61 + </trim>
  62 + <trim prefix="vip3_price =case" suffix="end,">
  63 + <foreach collection="productPriceList" item="item" index="index">
  64 + <if test="item.vip3Price!=null">
  65 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vip3Price,jdbcType=DECIMAL}
  66 + </if>
  67 + </foreach>
  68 + </trim>
  69 + <trim prefix="vip_discount_type =case" suffix="end,">
  70 + <foreach collection="productPriceList" item="item" index="index">
  71 + <if test="item.vipDiscountType!=null">
  72 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.vipDiscountType,jdbcType=TINYINT}
  73 + </if>
  74 + </foreach>
  75 + </trim>
  76 + <trim prefix="purchase_price =case" suffix="end,">
  77 + <foreach collection="productPriceList" item="item" index="index">
  78 + <if test="item.purchasePrice!=null">
  79 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.purchasePrice,jdbcType=DECIMAL}
  80 + </if>
  81 + </foreach>
  82 + </trim>
  83 + <trim prefix="purchase_discount =case" suffix="end,">
  84 + <foreach collection="productPriceList" item="item" index="index">
  85 + <if test="item.purchaseDiscount!=null">
  86 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.purchaseDiscount,jdbcType=DECIMAL}
  87 + </if>
  88 + </foreach>
  89 + </trim>
  90 + <trim prefix="cost_price =case" suffix="end,">
  91 + <foreach collection="productPriceList" item="item" index="index">
  92 + <if test="item.costPrice!=null">
  93 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.costPrice,jdbcType=DECIMAL}
  94 + </if>
  95 + </foreach>
  96 + </trim>
  97 + <trim prefix="return_coin =case" suffix="end,">
  98 + <foreach collection="productPriceList" item="item" index="index">
  99 + <if test="item.returnCoin!=null">
  100 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.returnCoin,jdbcType=SMALLINT}
  101 + </if>
  102 + </foreach>
  103 + </trim>
  104 + <trim prefix="founder =case" suffix="end,">
  105 + <foreach collection="productPriceList" item="item" index="index">
  106 + <if test="item.founder!=null">
  107 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.founder,jdbcType=INTEGER}
  108 + </if>
  109 + </foreach>
  110 + </trim>
  111 + <trim prefix="create_time =case" suffix="end,">
  112 + <foreach collection="productPriceList" item="item" index="index">
  113 + <if test="item.createTime!=null">
  114 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.createTime,jdbcType=INTEGER}
  115 + </if>
  116 + </foreach>
  117 + </trim>
  118 + <trim prefix="update_time =case" suffix="end,">
  119 + <foreach collection="productPriceList" item="item" index="index">
  120 + <if test="item.updateTime!=null">
  121 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.updateTime,jdbcType=INTEGER}
  122 + </if>
  123 + </foreach>
  124 + </trim>
  125 + <trim prefix="sys_status =case" suffix="end,">
  126 + <foreach collection="productPriceList" item="item" index="index">
  127 + <if test="item.sysStatus!=null">
  128 + when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.sysStatus,jdbcType=INTEGER}
  129 + </if>
  130 + </foreach>
  131 + </trim>
  132 + </trim>
  133 + where
  134 + <foreach collection="productPriceList" separator="or" item="item" index="index" >
  135 + product_skn= #{item.productSkn,jdbcType=INTEGER}
  136 + </foreach>
  137 +
  138 + </update>
  139 +```
  140 +
  141 +### 错误编码
  142 +
  143 +-------------------------
  144 +|错误码code|消息|说明|
  145 +|--------|----|----|
  146 +|200| 添加成功!| |
  147 +|400| 操作失败!| |
  148 +|500| 操作失败!| |
  149 +
  150 +### 返回 (备注 :code 为200代表成功 , data表示成功记录的表格所处相对路径)
  151 +
  152 +``` json
  153 +{
  154 + "code": 200,
  155 + "data": "1455604702941.xlsx",
  156 + "md5": "d751713988987e9331980363e24189ce",
  157 + "message": "Product Price update success."
  158 +}
  159 +
158 ``` 160 ```