addArticle
6.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# 新增资讯接口
> 接口名: `/guang/article/addArticle`
### 方法
> POST JSONRAW
### 入参
-------------------------
|属性名称|类型|例子|说明|
|--------|----|----|----|
|articleTitle|String|尖货盘点|资讯标题|
|articleGender|String|0|性别|
|authorId|int|3098|作者ID|
|maxSortId|int|12|一级分类ID|
|minSortId|int|35|二级分类ID|
|articleSummary|String|御寒首选|摘要|
|coverImage|String||封面图|
|coverImageType|int|1|图片类型|
|articleType|int|1|文章类型|
|adsImgSize|String|10881088|广告尺寸|
|url|String|{"action":"go.activity","url":"http://feature.yohobuy.com/0/0/373/index.html"}|链接|
|contentData|String|[{"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|欧美,复古,街头|文章标签|
---------------------
### 对应SQL的操作库表
```xml
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.yohobuy.platform.dal.guang.model.Article" >
insert into article
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="articleTitle != null" >
article_title,
</if>
<if test="maxSortId != null" >
max_sort_id,
</if>
<if test="minSortId != null" >
min_sort_id,
</if>
<if test="authorId != null" >
author_id,
</if>
<if test="coverImage != null" >
cover_image,
</if>
<if test="coverImageType != null" >
cover_image_type,
</if>
<if test="url != null" >
url,
</if>
<if test="adsImgSize != null" >
ads_img_size,
</if>
<if test="articleType != null" >
article_type,
</if>
<if test="articleSummary != null" >
article_summary,
</if>
<if test="articleGender != null" >
article_gender,
</if>
<if test="brand != null" >
brand,
</if>
<if test="tag != null" >
tag,
</if>
<if test="praise != null" >
praise,
</if>
<if test="browse != null" >
browse,
</if>
<if test="status != null" >
status,
</if>
<if test="isRecommend != null" >
is_recommend,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="publishTime != null" >
publish_time,
</if>
<if test="publishState != null" >
publish_state,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="articleTitle != null" >
#{articleTitle,jdbcType=VARCHAR},
</if>
<if test="maxSortId != null" >
#{maxSortId,jdbcType=INTEGER},
</if>
<if test="minSortId != null" >
#{minSortId,jdbcType=INTEGER},
</if>
<if test="authorId != null" >
#{authorId,jdbcType=INTEGER},
</if>
<if test="coverImage != null" >
#{coverImage,jdbcType=VARCHAR},
</if>
<if test="coverImageType != null" >
#{coverImageType,jdbcType=TINYINT},
</if>
<if test="url != null" >
#{url,jdbcType=VARCHAR},
</if>
<if test="adsImgSize != null" >
#{adsImgSize,jdbcType=VARCHAR},
</if>
<if test="articleType != null" >
#{articleType,jdbcType=TINYINT},
</if>
<if test="articleSummary != null" >
#{articleSummary,jdbcType=VARCHAR},
</if>
<if test="articleGender != null" >
#{articleGender,jdbcType=CHAR},
</if>
<if test="brand != null" >
#{brand,jdbcType=VARCHAR},
</if>
<if test="tag != null" >
#{tag,jdbcType=VARCHAR},
</if>
<if test="praise != null" >
#{praise,jdbcType=INTEGER},
</if>
<if test="browse != null" >
#{browse,jdbcType=INTEGER},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="isRecommend != null" >
#{isRecommend,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
<if test="publishTime != null" >
#{publishTime,jdbcType=INTEGER},
</if>
<if test="publishState != null" >
#{publishState,jdbcType=TINYINT},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<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>
<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| 请选择广告图片尺寸| |
|200| 添加成功!| |
|400| 添加失败!| |
### 返回
``` json
{
"code":200,
"message":"添加成功!"
}
```