saveProductParam.md
2.66 KB
保存参数
接口名:
/product/saveProductParam
方法
POST JSONRAW
入参
属性名称 | 类型 | 例子 | 说明 | 是否必填 | 长度限制 |
---|---|---|---|---|---|
productSkn | number | 商品skn | Y | 10 | |
attributeProValuesOne | 字符串 | 商品参数列表格式"[{'productSkn': 999, 'attributeId': 属性id, 'attributeValueId' : 属性值的Id}]" | N | 1024 | |
productStandardRelationStr | 字符串 | 商品基础参数"[{'standardId':452, 'standardVal':'常规', 'parameterMakeId':1223}, {'standardId':451, 'standardVal':'乳液', 'parameterMakeId':1213}]" | N | 1024 | |
productMaterial | 字符串 | N | 100 |
对应SQL的操作库表
<insert id="updateMaterial">
insert into product_special_attr (product_id, product_material)
values (#{productId,jdbcType=INTEGER}, #{productMaterial,jdbcType=VARCHAR})
ON DUPLICATE KEY UPDATE product_material=#{productMaterial,jdbcType=VARCHAR}
</insert>
<insert id="batchInsert" parameterType="java.util.List" >
insert into product_standard_relation (product_id, standard_id, standard_val,
parameter_make_id)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.productId,jdbcType=INTEGER}, #{item.standardId,jdbcType=SMALLINT}, #{item.standardVal,jdbcType=VARCHAR},
#{item.parameterMakeId,jdbcType=INTEGER})
</foreach>
</insert>
<delete id="deleteByProductId" >
delete from product_standard_relation
where product_id = #{productId,jdbcType=INTEGER}
</delete>
<delete id="delBatchBySkn" parameterType="java.lang.Integer" >
delete from product_attribute_property_values
where product_skn = #{productSkn,jdbcType=INTEGER} AND display_position in
<foreach collection="displayPositions" item="item" open="(" close=")" separator=",">
#{item, jdbcType=INTEGER}
</foreach>
</delete>
<insert id="insertBatch">
insert into product_attribute_property_values (product_skn, attribute_id,
attribute_value_id, display_position)
values
<foreach collection="doList" item="item" index="index" separator=",">
(#{item.productSkn,jdbcType=INTEGER}, #{item.attributeId,jdbcType=INTEGER},
#{item.attributeValueId,jdbcType=INTEGER}, #{item.displayPosition,jdbcType=INTEGER})
</foreach>
</insert>
错误编码
错误码code | 消息 | 说明 |
---|---|---|
200 | 添加成功! | |
400 | 操作失败! |
返回
{
"code": 200,
"data": [],
"md5": "d751713988987e9331980363e24189ce",
"message": "保存商品参数成功"
}