Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
yohoufo-fore
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
mali
6 years ago
Commit
fc15dc2a3940c5a75b3b75fbe9623b7b0fa53582
1 parent
0ac6e6c2
批量修改skup价格
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
0 deletions
dal/src/main/java/com/yohoufo/dal/product/StoragePriceMapper.java
dal/src/main/resources/META-INF/mybatis/product/StoragePriceMapper.xml
product/src/main/java/com/yohoufo/product/controller/ProductController.java
product/src/main/java/com/yohoufo/product/service/ProductService.java
product/src/main/java/com/yohoufo/product/service/impl/ProductServiceImpl.java
dal/src/main/java/com/yohoufo/dal/product/StoragePriceMapper.java
View file @
fc15dc2
...
...
@@ -36,4 +36,12 @@ public interface StoragePriceMapper {
List
<
StoragePrice
>
selectByStorageIds
(
List
<
Integer
>
storageIds
);
List
<
StoragePrice
>
selectBySkupList
(
@Param
(
"skupList"
)
List
<
Integer
>
skupList
);
/**
* 批量修改skup价格
* @param skupList
* @param price
* @return
*/
int
updateBatchPrice
(
@Param
(
"skupList"
)
List
<
Integer
>
skupList
,
@Param
(
"price"
)
Double
price
);
}
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/product/StoragePriceMapper.xml
View file @
fc15dc2
...
...
@@ -128,4 +128,13 @@
#{skup}
</foreach>
</update>
<update
id=
"updateBatchPrice"
>
update storage_price set price = #{price,jdbcType=DECIMAL},
update_time = unix_timestamp()
where skup in
<foreach
item=
"skup"
index=
"index"
collection=
"skupList"
open=
"("
separator=
","
close=
")"
>
#{skup}
</foreach>
</update>
</mapper>
\ No newline at end of file
...
...
product/src/main/java/com/yohoufo/product/controller/ProductController.java
View file @
fc15dc2
...
...
@@ -337,4 +337,28 @@ public class ProductController {
}
});
}
// 商家修改状态:1:上架 2:下架
@RequestMapping
(
params
=
"method=ufo.product.sellerBatchUpdatePrice"
)
public
ApiResponse
sellerBatchUpdatePrice
(
@RequestParam
(
value
=
"skupList"
,
required
=
true
)
List
<
Integer
>
skupList
,
@RequestParam
(
value
=
"price"
,
required
=
true
)
Double
price
){
LOG
.
info
(
"in method=ufo.product.sellerBatchUpdatePrice skupList is {}, price is {}"
,
skupList
,
price
);
if
(
null
==
price
||
price
<=
0
)
{
throw
new
ServiceException
(
400
,
"价格只能是非负数"
);
}
try
{
productService
.
sellerBatchUpdatePrice
(
skupList
,
price
);
//清缓存
LOG
.
info
(
"sellerBatchUpdatePrice success and async clearProductCache skupList = {}"
,
skupList
);
clearBatchProductCache
(
skupList
);
return
new
ApiResponse
(
200
,
"更新成功!"
,
Boolean
.
TRUE
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
"sellerBatchUpdatePrice失败!"
,
e
);
int
code
=
(
e
instanceof
ServiceException
)
?
((
ServiceException
)
e
).
getCode
()
:
500
;
return
new
ApiResponse
(
code
,
e
.
getMessage
(),
Boolean
.
FALSE
);
}
}
}
\ No newline at end of file
...
...
product/src/main/java/com/yohoufo/product/service/ProductService.java
View file @
fc15dc2
...
...
@@ -50,4 +50,12 @@ public interface ProductService {
void
sellerBatchUpdateStatus
(
List
<
Integer
>
skupList
,
int
status
);
List
<
StoragePrice
>
getStoragePriceBySkupList
(
List
<
Integer
>
skupList
);
/**
* 批量修改skup价格
* @param skupList
* @param price
* @return
*/
int
sellerBatchUpdatePrice
(
List
<
Integer
>
skupList
,
Double
price
);
}
...
...
product/src/main/java/com/yohoufo/product/service/impl/ProductServiceImpl.java
View file @
fc15dc2
...
...
@@ -634,4 +634,14 @@ public class ProductServiceImpl implements ProductService{
productDetailResp
.
setProduct_info
(
productInfo
);
return
productDetailResp
;
}
/**
* 批量修改skup价格
* @param skupList
* @param price
* @return
*/
public
int
sellerBatchUpdatePrice
(
List
<
Integer
>
skupList
,
Double
price
)
{
return
storagePriceMapper
.
updateBatchPrice
(
skupList
,
price
);
}
}
...
...
Please
register
or
login
to post a comment