updateArticle.md
5.53 KB
修改/发布(关闭)/推荐(取消推荐)资讯接口
接口名:
/guang/article/updateArticle
方法
POST JSONRAW
入参
属性名称 | 类型 | 例子 | 说明 | 是否必填 | 范围 |
---|---|---|---|---|---|
id | int | 1054 | 资讯ID | 是 | 1-11 |
articleTitle | String | 尖货盘点 | 资讯标题 | 是 | 1-85 |
articleGender | String | 0 | 性别 | 是 | 1-1 |
authorId | int | 3098 | 作者ID | 是 | 1-11 |
maxSortId | int | 12 | 一级分类ID | 是 | 1-11 |
minSortId | int | 35 | 二级分类ID | 否 | 0-11 |
articleSummary | String | 御寒首选 | 摘要 | 是 | 1-85 |
coverImage | String | 封面图 | 是 | 1-200 | |
coverImageType | int | 1 | 图片类型 | 是 | 1-1 |
articleType | int | 1 | 文章类型 | 是 | 1-1 |
adsImgSize | String | 10881088 | 广告尺寸 | 否 | 0-20 |
url | String | {"action":"go.activity","url":"http://feature.yohobuy.com/0/0/373/index.html"} | 链接 | 否 | 0-166 |
contentData | String | [{"id": 59,"orderBy":1,"templateKey":"singleImage","contentData":{"template_name":"singleImage","template_intro":"一张图片","data":{"0":{"url":{},"alt":"","src":""}}}"}] | 文章内容 | 否 | - |
brands | String | [{"id":102,"brandCategory":1},{"id":103,"brandCategory":2}] | 关联品牌信息,brandCategory 1 yohobuy品牌 2 全球购品牌 | 否 | - |
tag | String | 欧美,复古,街头 | 文章标签 | 否 | - |
status | int | 1(-1) | 发布(关闭) | 发布(关闭)时必填 | 1-2 |
isRecommend | int | 1(0) | 推荐(取消推荐) | 推荐(取消推荐)时必填 | 1-1 |
对应SQL的操作库表
<update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.guang.model.Article" >
update article
<set >
<if test="articleTitle != null" >
article_title = #{articleTitle,jdbcType=VARCHAR},
</if>
<if test="maxSortId != null" >
max_sort_id = #{maxSortId,jdbcType=INTEGER},
</if>
<if test="minSortId != null" >
min_sort_id = #{minSortId,jdbcType=INTEGER},
</if>
<if test="authorId != null" >
author_id = #{authorId,jdbcType=INTEGER},
</if>
<if test="coverImage != null" >
cover_image = #{coverImage,jdbcType=VARCHAR},
</if>
<if test="coverImageType != null" >
cover_image_type = #{coverImageType,jdbcType=TINYINT},
</if>
<if test="url != null" >
url = #{url,jdbcType=VARCHAR},
</if>
<if test="adsImgSize != null" >
ads_img_size = #{adsImgSize,jdbcType=VARCHAR},
</if>
<if test="articleType != null" >
article_type = #{articleType,jdbcType=TINYINT},
</if>
<if test="articleSummary != null" >
article_summary = #{articleSummary,jdbcType=VARCHAR},
</if>
<if test="articleGender != null" >
article_gender = #{articleGender,jdbcType=CHAR},
</if>
<if test="brand != null" >
brand = #{brand,jdbcType=VARCHAR},
</if>
<if test="tag != null" >
tag = #{tag,jdbcType=VARCHAR},
</if>
<if test="praise != null" >
praise = #{praise,jdbcType=INTEGER},
</if>
<if test="browse != null" >
browse = #{browse,jdbcType=INTEGER},
</if>
<if test="status != null" >
status = #{status,jdbcType=TINYINT},
publish_time = UNIX_TIMESTAMP(),
</if>
<if test="isRecommend != null" >
is_recommend = #{isRecommend,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="publishTime != null" >
publish_time = #{publishTime,jdbcType=INTEGER},
</if>
<if test="publishState != null" >
publish_state = #{publishState,jdbcType=TINYINT},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteByArticleId" parameterType="java.lang.Integer" >
delete from article_block
where article_id = #{articleId,jdbcType=INTEGER}
</delete>
<insert id="insertBatch" parameterType="java.util.List" >
insert into article_block (article_id, template_key,
order_by, create_time, content_data)
values
<foreach collection="list" item="item" separator=",">
(#{item.articleId,jdbcType=INTEGER}, #{item.templateKey,jdbcType=VARCHAR},
#{item.orderBy,jdbcType=INTEGER}, #{item.createTime,jdbcType=INTEGER}, #{item.contentData,jdbcType=LONGVARCHAR})
</foreach>
</insert>
<delete id="deleteByArticleId" parameterType="java.lang.Integer" >
delete from article_brand_relation
where article_id = #{articleId,jdbcType=INTEGER}
</delete>
<insert id="insertBatch" parameterType="java.util.List" >
insert into article_brand_relation (article_id, brand_id, brand_category, order_by,
create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.articleId,jdbcType=INTEGER}, #{item.brandId,jdbcType=INTEGER}, #{item.brandCategory,jdbcType=INTEGER}, #{item.orderBy,jdbcType=TINYINT},
#{item.createTime,jdbcType=INTEGER})
</foreach>
</insert>
错误编码
错误码code | 消息 | 说明 |
---|---|---|
400 | 请选择要修改的资讯! | |
400 | 请输入文章链接或文章内容 | |
400 | 请填写广告链接 | |
400 | 请选择广告图片尺寸 | |
400 | 状态不正确! | |
200 | 修改成功! | |
400 | 修改失败! |
返回
{
"code":200,
"message":"修改成功!"
}