Authored by wei

资源位

# 复制资源位预发布
> 接口名: `/resources/copyResContent
### 方法
> POST JSONRAW
### 入参
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|---|----|--------|
|rId|int|8|资源位id|是|11
### 对应SQL的操作库表
```xml
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from resources
where id = #{id,jdbcType=INTEGER}
</select>
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.yohobuy.platform.dal.cms.model.Resources" >
insert into resources
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="name != null" >
name,
</if>
<if test="sortId != null" >
sort_id,
</if>
<if test="platformId != null" >
platform_id,
</if>
<if test="code != null" >
code,
</if>
<if test="matchCode != null" >
match_code,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="publishTime !=null">
publish_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="sortId != null" >
#{sortId,jdbcType=INTEGER},
</if>
<if test="platformId != null" >
#{platformId,jdbcType=INTEGER},
</if>
<if test="code != null" >
#{code,jdbcType=VARCHAR},
</if>
<if test="matchCode != null" >
#{matchCode,jdbcType=VARCHAR},
</if>
<if test="createTime !=null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="publishTime !=null">
#{publishTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.yohobuy.platform.dal.cms.model.ResourcesContent" >
insert into resources_content
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="platformId != null" >
platform_id,
</if>
<if test="sortId != null" >
sort_id,
</if>
<if test="resourcesId != null" >
resources_id,
</if>
<if test="name != null" >
name,
</if>
<if test="orderBy != null" >
order_by,
</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="platformId != null" >
#{platformId,jdbcType=INTEGER},
</if>
<if test="sortId != null" >
#{sortId,jdbcType=INTEGER},
</if>
<if test="resourcesId != null" >
#{resourcesId,jdbcType=INTEGER},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="orderBy != null" >
#{orderBy,jdbcType=TINYINT},
</if>
UNIX_TIMESTAMP(),
</trim>
</insert>
<select id="getByContentId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
SELECT
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List" />
from resources_content_data where resource_content_id= #{resourceContentId,jdbcType=INTEGER}
</select>
<insert id="insertSelective" parameterType="com.yohobuy.platform.dal.cms.model.ResourcesContentData" >
insert into resources_content_data
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="platformId != null" >
platform_id,
</if>
<if test="sortId != null" >
sort_id,
</if>
<if test="resourceContentId != null" >
resource_content_id,
</if>
<if test="templateKey != null" >
template_key,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="contentData != null" >
content_data,
</if>
<if test="preContentId != null" >
pre_content_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="platformId != null" >
#{platformId,jdbcType=INTEGER},
</if>
<if test="sortId != null" >
#{sortId,jdbcType=INTEGER},
</if>
<if test="resourceContentId != null" >
#{resourceContentId,jdbcType=INTEGER},
</if>
<if test="templateKey != null" >
#{templateKey,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=VARCHAR},
</if>
<if test="contentData != null" >
#{contentData,jdbcType=LONGVARCHAR},
</if>
<if test="preContentId != null" >
#{preContentId,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
```
### 错误编码
-------------------------
|错误码code|消息|说明|
|--------|----|----|
|200|操作成功| |
|400|资源id不能为空!| |
|500|资源位无法复制!| |
### 返回
``` json
{
"code": 200,
"data": [
{
"contentData": [
{
"contentData": "{\"template_name\":\"singleImage\",\"template_intro\":\"一张图片\",\"data\":{\"0\":{\"url\":{},\"alt\":\"\",\"src\":\"http://img10.static.yhbimg.com/yhb-img01/2015/05/22/15/01b90a9c7e541bb4467b30c9a9f3ff0436.jpg?imageView/{mode}/w/{width}/h/{height}\",\"imgId\":\"0\"}}}",
"createTime": 1461896882,
"id": 6754,
"platformId": 1,
"preContentId": 119,
"publishTime": 0,
"resourceContentId": 6760,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"data\":{\"title\":{\"title\":\"自定义品牌\"},\"list\":{\"0\":{\"src\":\"http://img10.static.yhbimg.com/brandLogo/2011/06/26/19/016f21d6a39d5071e1864943253dcdefde.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"1\",\"name\":\"004\"},\"1\":{\"src\":\"http://img10.static.yhbimg.com/brandLogo/2011/06/13/10/01ecc0da4a2c0ce298b70eae8ef880adc8.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"3\",\"name\":\"3SUMMER\"},\"2\":{\"src\":\"http://img12.static.yhbimg.com/brandLogo/2011/06/24/11/0258db45c21576719cbd40f744369a43e7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"4\",\"name\":\"5CM\"},\"3\":{\"src\":\"http://img12.static.yhbimg.com/brandLogo/2011/06/20/20/02b099b0a1fad5f18681dcccbabdbbc0f7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"6\",\"name\":\"ACROSS!\"}}},\"template_name\":\"customBrands\",\"template_intro\":\"自定义品牌\"}",
"createTime": 1461896882,
"id": 6756,
"platformId": 1,
"preContentId": 127,
"publishTime": 0,
"resourceContentId": 6762,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"template_name\":\"goods\",\"template_intro\":\"添加商品\",\"data\":{\"0\":{\"src\":\"http://img10.static.yhbimg.com/goodsimg/2015/05/19/07/0128dee5ee03762b49994acba26b33ad4f.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51110541\"},\"1\":{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2015/05/19/07/02bb341824c649e449bb75172838cc2137.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51110539\"},\"2\":{\"src\":\"http://img10.static.yhbimg.com/goodsimg/2015/05/19/07/0187370daa7c39034032f23dd13d95a978.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51109824\"}}}",
"createTime": 1461896882,
"id": 6758,
"platformId": 1,
"preContentId": 123,
"publishTime": 0,
"resourceContentId": 6764,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"template_name\":\"promotion\",\"template_intro\":\"促销专区\",\"data\":{\"promotionId\":\"101\"}}",
"createTime": 1461896882,
"id": 6760,
"platformId": 1,
"preContentId": 125,
"publishTime": 0,
"resourceContentId": 6766,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
}
],
"resource": {
"code": "fbae3d10de7d1573b96e4dac6c05b918",
"createTime": 1461896882,
"id": 776,
"matchCode": "",
"name": "tee manj",
"platformId": 1,
"publishTime": 1461983282,
"sortId": 6
},
"status": 2
},
{
"contentData": [
{
"contentData": "{\"template_name\":\"singleImage\",\"template_intro\":\"一张图片\",\"data\":{\"0\":{\"url\":{},\"alt\":\"\",\"src\":\"http://img10.static.yhbimg.com/yhb-img01/2015/05/22/15/01b90a9c7e541bb4467b30c9a9f3ff0436.jpg?imageView/{mode}/w/{width}/h/{height}\",\"imgId\":\"0\"}}}",
"createTime": 1461895996,
"id": 6746,
"platformId": 1,
"preContentId": 119,
"publishTime": 0,
"resourceContentId": 6752,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"data\":{\"title\":{\"title\":\"自定义品牌\"},\"list\":{\"0\":{\"src\":\"http://img10.static.yhbimg.com/brandLogo/2011/06/26/19/016f21d6a39d5071e1864943253dcdefde.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"1\",\"name\":\"004\"},\"1\":{\"src\":\"http://img10.static.yhbimg.com/brandLogo/2011/06/13/10/01ecc0da4a2c0ce298b70eae8ef880adc8.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"3\",\"name\":\"3SUMMER\"},\"2\":{\"src\":\"http://img12.static.yhbimg.com/brandLogo/2011/06/24/11/0258db45c21576719cbd40f744369a43e7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"4\",\"name\":\"5CM\"},\"3\":{\"src\":\"http://img12.static.yhbimg.com/brandLogo/2011/06/20/20/02b099b0a1fad5f18681dcccbabdbbc0f7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"6\",\"name\":\"ACROSS!\"}}},\"template_name\":\"customBrands\",\"template_intro\":\"自定义品牌\"}",
"createTime": 1461895996,
"id": 6748,
"platformId": 1,
"preContentId": 127,
"publishTime": 0,
"resourceContentId": 6754,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"template_name\":\"goods\",\"template_intro\":\"添加商品\",\"data\":{\"0\":{\"src\":\"http://img10.static.yhbimg.com/goodsimg/2015/05/19/07/0128dee5ee03762b49994acba26b33ad4f.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51110541\"},\"1\":{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2015/05/19/07/02bb341824c649e449bb75172838cc2137.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51110539\"},\"2\":{\"src\":\"http://img10.static.yhbimg.com/goodsimg/2015/05/19/07/0187370daa7c39034032f23dd13d95a978.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51109824\"}}}",
"createTime": 1461895996,
"id": 6750,
"platformId": 1,
"preContentId": 123,
"publishTime": 0,
"resourceContentId": 6756,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"template_name\":\"promotion\",\"template_intro\":\"促销专区\",\"data\":{\"promotionId\":\"101\"}}",
"createTime": 1461895996,
"id": 6752,
"platformId": 1,
"preContentId": 125,
"publishTime": 0,
"resourceContentId": 6758,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
}
],
"resource": {
"code": "fbae3d10de7d1573b96e4dac6c05b918",
"createTime": 1461895996,
"id": 774,
"matchCode": "",
"name": "tee manj",
"platformId": 1,
"publishTime": 1461982396,
"sortId": 6
},
"status": 2
},
{
"contentData": [
{
"contentData": "{\"template_name\":\"singleImage\",\"template_intro\":\"一张图片\",\"data\":{\"0\":{\"url\":{},\"alt\":\"\",\"src\":\"http://img10.static.yhbimg.com/yhb-img01/2015/05/22/15/01b90a9c7e541bb4467b30c9a9f3ff0436.jpg?imageView/{mode}/w/{width}/h/{height}\",\"imgId\":\"0\"}}}",
"createTime": 1432278954,
"id": 119,
"platformId": 1,
"preContentId": 119,
"publishTime": 0,
"resourceContentId": 119,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"data\":{\"title\":{\"title\":\"自定义品牌\"},\"list\":{\"0\":{\"src\":\"http://img10.static.yhbimg.com/brandLogo/2011/06/26/19/016f21d6a39d5071e1864943253dcdefde.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"1\",\"name\":\"004\"},\"1\":{\"src\":\"http://img10.static.yhbimg.com/brandLogo/2011/06/13/10/01ecc0da4a2c0ce298b70eae8ef880adc8.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"3\",\"name\":\"3SUMMER\"},\"2\":{\"src\":\"http://img12.static.yhbimg.com/brandLogo/2011/06/24/11/0258db45c21576719cbd40f744369a43e7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"4\",\"name\":\"5CM\"},\"3\":{\"src\":\"http://img12.static.yhbimg.com/brandLogo/2011/06/20/20/02b099b0a1fad5f18681dcccbabdbbc0f7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center\",\"id\":\"6\",\"name\":\"ACROSS!\"}}},\"template_name\":\"customBrands\",\"template_intro\":\"自定义品牌\"}",
"createTime": 1432279642,
"id": 127,
"platformId": 1,
"preContentId": 127,
"publishTime": 0,
"resourceContentId": 127,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"template_name\":\"goods\",\"template_intro\":\"添加商品\",\"data\":{\"0\":{\"src\":\"http://img10.static.yhbimg.com/goodsimg/2015/05/19/07/0128dee5ee03762b49994acba26b33ad4f.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51110541\"},\"1\":{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2015/05/19/07/02bb341824c649e449bb75172838cc2137.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51110539\"},\"2\":{\"src\":\"http://img10.static.yhbimg.com/goodsimg/2015/05/19/07/0187370daa7c39034032f23dd13d95a978.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90\",\"id\":\"51109824\"}}}",
"createTime": 1432278954,
"id": 123,
"platformId": 1,
"preContentId": 123,
"publishTime": 0,
"resourceContentId": 123,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
},
{
"contentData": "{\"template_name\":\"promotion\",\"template_intro\":\"促销专区\",\"data\":{\"promotionId\":\"101\"}}",
"createTime": 1432278954,
"id": 125,
"platformId": 1,
"preContentId": 125,
"publishTime": 0,
"resourceContentId": 125,
"sortId": 6,
"templateKey": "123",
"updateTime": 0
}
],
"resource": {
"code": "fbae3d10de7d1573b96e4dac6c05b918",
"createTime": 1431399961,
"id": 31,
"matchCode": "",
"name": "tee manj",
"platformId": 1,
"publishTime": 0,
"sortId": 6
}
}
],
"md5": "aac38906e4ed136bb5b4f1291d7eef51",
"message": "操作成功"
}
```
... ...
# 通过code删除所有资源位
> 接口名: `/resources/deleteAllResourceByCode
### 方法
> POST JSONRAW
### 入参
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|---|----|--------|
|code|string|8c48745a39373d621bf5fd80edf59b5e|code码|是|255
### 对应SQL的操作库表
```xml
<delete id="deleteAllResourceByCode">
delete from resources
where code = #{code}
</delete>
```
### 错误编码
-------------------------
|错误码code|消息|说明|
|--------|----|----|
|200|删除成功| |
|400|code is null| |
|500|deleteAllResourceByCode wrong.| |
### 返回
``` json
{
"code": 200,
"data": [],
"md5": "d751713988987e9331980363e24189ce",
"message": "删除成功."
}
```
... ...
# 更新预发布时间
> 接口名: `/resources/updateResPublishTime
### 方法
> POST JSONRAW
### 入参
-------------------------
|属性名称|类型|例子|说明|是否必填|长度限制|
|--------|----|----|---|----|--------|
|id|int|8|资源位id|是|11
|time|string|2016-04-27 10:50:00|预发布时间|是|225
### 对应SQL的操作库表
```xml
<update id="updateResPublishTime">
update resources set publish_time=#{publishTime} where id=#{id}
</update>
```
### 错误编码
-------------------------
|错误码code|消息|说明|
|--------|----|----|
|200|操作成功| |
|400|id can not null| |
|500|updateResPublishTime wrong| |
### 返回
``` json
{
"code": 200,
"data": [],
"md5": "d751713988987e9331980363e24189ce",
"message": "删除成功."
}
```
... ...