通用模块修改

This commit is contained in:
wuchunlei
2024-03-25 11:27:37 +08:00
parent c32eaf2db5
commit 92a582bee0
2 changed files with 35 additions and 39 deletions

View File

@@ -236,9 +236,6 @@ public class BookLabelAndMarketController {
@RequestMapping(path = "/saveToLabel")
public R saveToLabel(@RequestBody Map params) {
LambdaQueryWrapper<ShopProductToBookLabel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ShopProductToBookLabel::getBookLabelId,params.get("bookLabelId").toString());
toLabelService.remove(wrapper);
if (!StringUtils.isEmpty(params.get("productId").toString())){
String[] ids = params.get("productId").toString().split(",");
if (ids.length > 0) {
@@ -255,15 +252,12 @@ public class BookLabelAndMarketController {
@RequestMapping(path = "/saveToMarket")
public R saveToMarket(@RequestBody Map params) {
LambdaQueryWrapper<ShopProductToBookMarket> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ShopProductToBookMarket::getBookMarketId,params.get("bookMarketId").toString());
toMarketService.remove(wrapper);
if (!StringUtils.isEmpty(params.get("productId").toString())){
String[] ids = params.get("productId").toString().split(",");
if (ids.length > 0) {
for (String id : ids) {
ShopProductToBookMarket toMarket = new ShopProductToBookMarket();
toMarket.setBookMarketId(Integer.parseInt(params.get("bookLabelId").toString()));
toMarket.setBookMarketId(Integer.parseInt(params.get("bookMarketId").toString()));
toMarket.setProductId(Integer.parseInt(id));
toMarketService.save(toMarket);
}