商品设置退换货接口服务定义
1.查询所有ProductSkn和模糊匹配查询ProductSkn
接口名:/refundExchangeAttribute/queryRefundExchangeProductSkn
入参
{
}
or
{
"idName":"500008"
}
属性名称 |
类型 |
例子 |
说明 |
是否必填 |
长度限制 |
idName |
String |
"500008" |
产品SKN(productSkn) |
可选 |
无 |
对应SQL的操作库表(数据库 erp_product,表product)
<select id="selectRefundExchangeProductSkn" resultType="java.lang.Integer">
select product_skn
from product
<where>
<if test="productSkn != null and productSkn != ''">
product_skn like concat('%',#{productSkn},'%')
</if>
</where>
limit 100
</select>
错误编码
返回
{
"code": 200,
"data": [
{
"id": 50000055,
"text": "50000055"
},
{
"id": 50000056,
"text": "50000056"
},
{
"id": 50000057,
"text": "50000057"
}
],
"message": "操作成功"
}
2.查询所有品牌和模糊匹配查询品牌(以前平台化接口)
接口名:/erpproduct/brands/getBrandNames
入参
{
}
or
{
"idName":"43"
}
属性名称 |
类型 |
例子 |
说明 |
是否必填 |
长度限制 |
idName |
String |
"43" |
品牌id或者名称 |
可选 |
无 |
对应SQL的操作库表(数据库 erp_product,表 brand)
!-- selectBriefBrandList 根据条件查询BrandList -->
<select id="selectBriefBrandList" resultMap="BriefResultMap">
select
<include refid="Brief_Column_List" />
from brand where 1=1
<if test="status != 0">
and status=#{status}
</if>
<if test="idOrName != null and idOrName != ''">
and (id like CONCAT('%',#{idOrName},'%')
or brand_name like CONCAT('%',#{idOrName},'%'))
</if>
order by id desc limit #{limit}
</select>
错误编码
返回
{
"code": 200,
"data": [
{
"brandNameEn": "test",
"id": "1430",
"text": "AAAA2"
},
{
"brandNameEn": "C'TERBOX",
"id": "1343",
"text": "C'TERBOX"
},
{
"brandNameEn": "monopoly",
"id": "1243",
"text": "monopoly"
}
],
"message": "操作成功"
}
3.查询或筛选全部列表
接口名:/refundExchangeAttribute/queryRefundExchangeList
入参
{
"productSkn":50000855,
"brandId" :133,
"isRefundExchange" :133
}
属性名称 |
类型 |
例子 |
说明 |
是否必填 |
长度限制 |
productSkn |
int |
500008 |
产品SKN |
是 |
无 |
brandId |
int |
133 |
品牌ID |
是 |
无 |
isRefundExchange |
int |
0 |
是否支持退换货(0、不支持退换货-特殊商品 1、支持退换货-普通商品) |
是 |
无 |
1. 对应SQL的操作库表(数据库 erp_product,表 product, 字段is_refund_exchange=1 )
<select id="selectRefundExchangeList" parameterType="com.yohobuy.platform.model.common.PageBean" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product
<where>
<if test="params.productSkn != null and params.productSkn !=-1">
product_skn= #{params.productSkn,jdbcType=INTEGER}
</if>
<if test="params.brandId != null and params.brandId != -1 ">
and brand_id=#{params.brandId, jdbcType=SMALLINT}
</if>
</where>
<if test="params.isLimit != null and params.isLimit == true">
limit #{startIndex},#{pageSize}
</if>
</select>
2. 对应SQL的操作库表(数据库 erp_product,表 brand)
<select id="selectByBrandIds" resultMap="BaseResultMap">
select id, brand_name, brand_domain, brand_name_cn, brand_name_en, status, sale_type from brand
where id in
<foreach item="brandId" collection="brandIds" open="(" separator="," close=")">
#{brandId}
</foreach>
</select>
3. 对应SQL的操作库表(数据库 erp_product,表 product_sort)
<select id="selectBySmallSortIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_sort
where id in
<foreach collection="smallSortIds" item="item" index="index" separator="," open="(" close=")">
#{item, jdbcType=SMALLINT}
</foreach>
</select>
4. 对应SQL的操作库表(数据库 erp_product,表 product_ext_attribute)
<select id="selectByProductSkns" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_ext_attribute
where product_skn in
<foreach collection="productSkns" item="productSkn" index="index" separator="," open="(" close=")">
#{productSkn,jdbcType=INTEGER}
</foreach>
</select>
返回
{
"code": 200,
"data": {
"list": [
{
"brandId": 175,
"brandName": "团一",
"isRefundExchange": 1,
"productSkn": 50000055,
"sortIsRefundExchange": -1
},
{
"brandId": 187,
"brandName": "顽",
"isRefundExchange": 1,
"productSkn": 50000056,
"sortIsRefundExchange": -1
},
{
"brandId": 63,
"brandName": "another-Group",
"isRefundExchange": 1,
"productSkn": 50000057,
"sortIsRefundExchange": -1
},
{
"brandId": 137,
"brandName": "TEKMO!多点",
"isRefundExchange": 1,
"productSkn": 50000058,
"sortIsRefundExchange": -1
},
{
"brandId": 80,
"brandName": "Magicstar",
"isRefundExchange": 1,
"productSkn": 50000060,
"sortIsRefundExchange": -1
},
{
"brandId": 138,
"brandName": "THETHING",
"isRefundExchange": 1,
"productSkn": 50000061,
"sortIsRefundExchange": -1
},
{
"brandId": 162,
"brandName": "黑头BLACKHEAD",
"isRefundExchange": 1,
"productSkn": 50000062,
"sortIsRefundExchange": -1
},
{
"brandId": 10,
"brandName": "Alive World",
"isRefundExchange": 1,
"productSkn": 50000063,
"sortIsRefundExchange": -1
},
{
"brandId": 176,
"brandName": "翼品堂",
"isRefundExchange": 1,
"productSkn": 50000064,
"sortIsRefundExchange": -1
},
{
"brandId": 37,
"brandName": "EBLIS",
"isRefundExchange": 1,
"productSkn": 50000066,
"sortIsRefundExchange": -1
}
],
"page": 1,
"size": 10,
"total": 220121,
"totalPage": 22013
},
"message": "操作成功"
}
注意: sortIsRefundExchange默认值为-1(无效值),如果值为0,说明品类是关闭的,不管设置商品什么退换货状态,都按品类状态来,不可修改状态。
4.修改商品退换货状态
接口名:/refundExchangeAttribute/modifyRefundExchangeStatus
入参
{
"productSkn": 50000055,
"isRefundExchange":0
}
属性名称 |
类型 |
例子 |
说明 |
是否必填 |
长度限制 |
productSkn |
int |
500008 |
产品SKN |
是 |
无 |
isRefundExchange |
int |
0 |
是否支持退换货(0、不支持退换货-特殊商品 1、支持退换货-普通商品) |
是 |
无 |
1. 对应SQL的操作库表(数据库 erp_product,表 product_ext_attribute)
<select id="selectByProductSkn" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_ext_attribute
where product_skn = #{productSkn,jdbcType=INTEGER}
limit 1
</select>
2. 对应SQL的操作库表(数据库 erp_product,表 product_ext_attribute)
<insert id="insertSelective" parameterType="com.yohobuy.platform.dal.product.model.ErpProductExtAttribute" >
insert into product_ext_attribute
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="productSkn != null" >
product_skn,
</if>
<if test="isRefundExchange != null" >
is_refund_exchange,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="productSkn != null" >
#{productSkn,jdbcType=INTEGER},
</if>
<if test="isRefundExchange != null" >
#{isRefundExchange,jdbcType=INTEGER},
</if>
</trim>
</insert>
3. 对应SQL的操作库表(数据库 erp_product,表 product_ext_attribute)
<update id="updateByProductSknSelective" parameterType="com.yohobuy.platform.dal.product.model.ErpProductExtAttribute" >
update product_ext_attribute
<set >
<if test="isRefundExchange != null" >
is_refund_exchange = #{isRefundExchange,jdbcType=INTEGER},
</if>
</set>
where product_skn = #{productSkn,jdbcType=INTEGER},
</update>
4. 对应SQL的操作库表(数据库 yh_shops,表 product_ext_attribute)的3条sql与前面3条sql相同
返回
{
"code": 200,
"message": "修改退换货状态操作成功"
}
5.批量导入商品退换货状态
接口名: /batch/import
入参
{
"type":"refundExchangeModify",
"file":"具体文件流"
}
属性名称 |
类型 |
例子 |
说明 |
是否必填 |
长度限制 |
type |
String |
refundExchangeModify |
键类型(退换货) |
是 |
无 |
file |
file |
下载url为"/common/refundExchange.xlsx" |
文件 |
是 |
无 |
1. 对应SQL的操作库表(数据库 erp_product,表 product)
<select id="selectByPrimaryKeyList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product
where product_skn in
<foreach collection="sknList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
2. 对应SQL的操作库表(数据库 erp_product, 表 product_sort)
<select id="selectBySmallSortIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_sort
where id in
<foreach collection="smallSortIds" item="item" index="index" separator="," open="(" close=")">
#{item, jdbcType=SMALLINT}
</foreach>
</select>
3. 对应SQL的操作库表(数据库 erp_product, 表 product_ext_attribute)
<select id="selectBySmallSortIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_sort
where id in
<foreach collection="smallSortIds" item="item" index="index" separator="," open="(" close=")">
#{item, jdbcType=SMALLINT}
</foreach>
</select>
4. 对应SQL的操作库表(数据库 erp_product, 表 product_ext_attribute)
<update id="updateBatchRefundExchangeStatus">
update product_ext_attribute
<trim prefix="set" suffixOverrides=",">
<trim prefix="is_refund_exchange = case" suffix="end,">
<foreach collection="list" item="item" index="index">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.isRefundExchange,jdbcType=INTEGER}
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="item" index="index" >
product_skn= #{item.productSkn,jdbcType=INTEGER}
</foreach>
</update>
5. 对应SQL的操作库表(数据库 erp_product, 表 product_ext_attribute)
<insert id="insertBatchRefundExchangeStatus">
insert into product_ext_attribute(product_skn, is_refund_exchange)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.productSkn},#{item.isRefundExchange})
</foreach>
</insert>
6. 对应SQL的操作库表(数据库 yh_shops, 表 product_ext_attribute)
<update id="updateBatchRefundExchangeStatus">
update product_ext_attribute
<trim prefix="set" suffixOverrides=",">
<trim prefix="is_refund_exchange = case" suffix="end,">
<foreach collection="list" item="item" index="index">
when product_skn=#{item.productSkn,jdbcType=INTEGER} then #{item.isRefundExchange,jdbcType=INTEGER}
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="item" index="index" >
product_skn= #{item.productSkn,jdbcType=INTEGER}
</foreach>
</update>
7. 对应SQL的操作库表(数据库 yh_shops, 表 product_ext_attribute)
<insert id="insertBatchRefundExchangeStatus">
insert into product_ext_attribute(product_skn, is_refund_exchange)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.productSkn},#{item.isRefundExchange})
</foreach>
</insert>
返回
{
"code": 200,
"data": {
"failFileReason": [
"第2行:退换货状态输入错误,请修改\r\n"
],
"repeatFileReason": [
"SKN_50001796,出现2次,已经重复,请修改\r\n"
],
"successList": [
{
"brandId": -1,
"isRefundExchange": 1,
"productSkn": 50000684,
"sortIsRefundExchange": -1
},
{
"brandId": -1,
"isRefundExchange": 1,
"productSkn": 50001796,
"sortIsRefundExchange": -1
},
{
"brandId": -1,
"isRefundExchange": 1,
"productSkn": 50001796,
"sortIsRefundExchange": -1
}
]
},
"message": "处理成功"
}
注意: (1)failFileReason和repeatFileReason这两个Json数组,只要有一个Json数组返回不为空,说明此次导入操作失败;(2) failFileReason和repeatFileReason这两个Json数组错误信息都要在前台展示。
6.批量导出商品退换货状态xls
接口名:/batch/export
入参
{
"type":"productRefundExchangeExport",
"queryConf":"{
"productSkn":50000855,
"brandId" :133,
"isRefundExchange" :1
}"
}
属性名称 |
类型 |
例子 |
说明 |
是否必填 |
长度限制 |
type |
String |
"productRefundExchangeExport" |
导出数据键类型(必须) |
是 |
无 |
queryConf |
String |
"{...}" |
筛选条件 |
否 |
无 |
productSkn |
int |
500008 |
产品SKN |
否 |
无 |
brandId |
int |
133 |
品牌ID |
否 |
无 |
isRefundExchange |
int |
0 |
是否支持退换货(0、不支持退换货-特殊商品 1、支持退换货-普通商品) |
否 |
无 |
1. 对应SQL的操作库表(数据库 yh_shops, 表product, 字段is_pay_delivery=1 )
1. 对应SQL的操作库表(数据库 erp_product,表 product, 字段is_refund_exchange=1 )
<select id="selectRefundExchangeList" parameterType="com.yohobuy.platform.model.common.PageBean" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product
<where>
<if test="params.productSkn != null and params.productSkn !=-1">
product_skn= #{params.productSkn,jdbcType=INTEGER}
</if>
<if test="params.brandId != null and params.brandId != -1 ">
and brand_id=#{params.brandId, jdbcType=SMALLINT}
</if>
</where>
<if test="params.isLimit != null and params.isLimit == true">
limit #{startIndex},#{pageSize}
</if>
</select>
2. 对应SQL的操作库表(数据库 erp_product,表 brand)
<select id="selectByBrandIds" resultMap="BaseResultMap">
select id, brand_name, brand_domain, brand_name_cn, brand_name_en, status, sale_type from brand
where id in
<foreach item="brandId" collection="brandIds" open="(" separator="," close=")">
#{brandId}
</foreach>
</select>
3. 对应SQL的操作库表(数据库 erp_product,表 product_sort)
<select id="selectBySmallSortIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_sort
where id in
<foreach collection="smallSortIds" item="item" index="index" separator="," open="(" close=")">
#{item, jdbcType=SMALLINT}
</foreach>
</select>
4. 对应SQL的操作库表(数据库 erp_product,表 product_ext_attribute)
<select id="selectByProductSkns" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_ext_attribute
where product_skn in
<foreach collection="productSkns" item="productSkn" index="index" separator="," open="(" close=")">
#{productSkn,jdbcType=INTEGER}
</foreach>
</select>
错误编码
返回 excel表格
SKN |
品牌 |
是否特殊商品(是:0;否:1) |
50000684 |
破壳 |
1 |