updateSCLabel.md 9.69 KB

更新销售类目的标签接口

接口名: /salesCategoryLabel/updateSCLabel

方法

POST JSONRAW

入参

属性名称 类型 例子 说明 是否必填 长度限制
labelId String 1 标签id 5
labelName String 袖长 标签名称 50
categoryId string 关联的销售类目id 5
parentId string 1 父标签id 5
orderBy string 0 排序 5
labelLevel string 1 标签等级 5
status string 0 销售类目状态1:开启 0:关闭 5

对应SQL的操作库表

  <update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.product.model.SalesCategoryLabel">
        update sales_category_label
        <set>
            <if test="labelName != null">
                label_name = #{labelName,jdbcType=VARCHAR},
            </if>
            <if test="categoryId != null">
                category_id = #{categoryId,jdbcType=INTEGER},
            </if>
            <if test="parentId != null">
                parent_id = #{parentId,jdbcType=INTEGER},
            </if>
            <if test="labelLevel != null">
                label_level = #{labelLevel,jdbcType=INTEGER},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="orderBy != null">
                order_by = #{orderBy,jdbcType=INTEGER},
            </if>
        </set>
        where label_id = #{labelId,jdbcType=INTEGER}
    </update>

响应码


响应码code 消息 说明
200 updateCategoryLabel success
400 类目id丢失/修改参数不合法

返回

{
  "code": 200,
  "data": [],
  "md5": "d751713988987e9331980363e24189ce",
  "message": "updateSCLabel success."
}

批量更新销售类目的标签接口

接口名: /salesCategoryLabel/updateBatchSCLabel

方法

POST JSONRAW

入参

属性名称 类型 例子 说明 是否必填 长度限制
labelId String 1 标签id 5
labelName String 袖长 标签名称 50
categoryId string 关联的销售类目id 5
parentId string 1 父标签id 5
orderBy string 0 排序 5
labelLevel string 1 标签等级 5
status string 0 销售类目状态1:开启 0:关闭 5

入参例

{
        "scLabelItemList": [
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "416",
                "labelLevel": "1",
                "labelName": "经典款型",
                "orderBy": "1",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "434",
                "labelLevel": "1",
                "labelName": "版型",
                "orderBy": "2",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "432",
                "labelLevel": "1",
                "labelName": "衣长",
                "orderBy": "3",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "430",
                "labelLevel": "1",
                "labelName": "腰型",
                "orderBy": "4",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "428",
                "labelLevel": "1",
                "labelName": "裤长",
                "orderBy": "0",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "426",
                "labelLevel": "1",
                "labelName": "袖长",
                "orderBy": "5",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "424",
                "labelLevel": "1",
                "labelName": "领型",
                "orderBy": "6",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "422",
                "labelLevel": "1",
                "labelName": "厚度",
                "orderBy": "7",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "420",
                "labelLevel": "1",
                "labelName": "袖型",
                "orderBy": "8",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "418",
                "labelLevel": "1",
                "labelName": "面料材质",
                "orderBy": "9",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            },
            {
                "categoryId": "92",
                "createTime": "1460453360",
                "labelId": "436",
                "labelLevel": "1",
                "labelName": "肩型",
                "orderBy": "10",
                "parentId": "0",
                "status": "1",
                "updateTime": "1460453360"
            }
        ]
    }

对应SQL的操作库表

 <update id="updateBatchByPrimaryKeySelective" parameterType="java.util.List">
        update sales_category_label
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="label_name =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.labelName!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.labelName,jdbcType=VARCHAR}
                       </if>
               </foreach>
            </trim>
            <trim prefix="category_id =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.categoryId!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.categoryId,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
            <trim prefix="parent_id =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.parentId!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.parentId,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
            <trim prefix="label_level =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.labelLevel!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.labelLevel,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
            <trim prefix="status =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.status!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.status,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
            <trim prefix="create_time =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.createTime!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.createTime,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
            <trim prefix="update_time =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.updateTime!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.updateTime,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
            <trim prefix="order_by =case" suffix="end,">
               <foreach collection="scLabelList" item="item" index="index">
                       <if test="item.orderBy!=null">
                        when label_id=#{item.labelId,jdbcType=INTEGER} then #{item.orderBy,jdbcType=INTEGER}
                       </if>
               </foreach>
            </trim>
         </trim>
            where
          <foreach collection="scLabelList" separator="or" item="item" index="index" >
            label_id= #{item.labelId,jdbcType=INTEGER}
        </foreach>
  </update>

响应码


响应码code 消息 说明
200 updateBatchSCLabel success
400 入口参数异常

返回

{
  "code": 200,
  "data": [],
  "md5": "d751713988987e9331980363e24189ce",
  "message": "updateBatchSCLabel success."
}