图书商品标签修改

This commit is contained in:
wuchunlei
2024-03-22 16:55:08 +08:00
parent c7ea264066
commit 80a13f95ce

View File

@@ -1,6 +1,7 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
@@ -145,7 +146,27 @@ public class BookLabelAndMarketController {
}
}
/**
* 获取未关联商品列表
*/
@RequestMapping("/getNotToLabelList")
public R getNotToLabelList(@RequestBody Map params){
LambdaQueryWrapper<ShopProduct> wrapper = new LambdaQueryWrapper();
if (!"".equals(params.get("goodsType").toString())){
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
}
if (!"".equals(params.get("bookLabelId").toString())){
String sql = "select product_id from shop_product_to_book_label where del_flag = 0 and book_label_id = "+params.get("bookLabelId");
wrapper.notInSql(ShopProduct::getProductId,sql);
}
if (!"".equals(params.get("bookMarketId").toString())){
String sql = "select product_id from shop_product_to_book_market where del_flag = 0 and book_market_id = "+params.get("bookLabelId");
wrapper.notInSql(ShopProduct::getProductId,sql);
}
Page<ShopProduct> page = productService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page);
}
/**
* 获取书标签列表
@@ -158,6 +179,9 @@ public class BookLabelAndMarketController {
if (params.containsKey("productName")&&!"".equals(params.get("productName").toString())){
wrapper.like(ShopProduct::getProductName,params.get("productName").toString());
}
if (params.containsKey("goodsType")&&!"".equals(params.get("goodsType").toString())){
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
}
if (params.containsKey("productId")&&!"".equals(params.get("productId").toString())){
wrapper.eq(ShopProductToBookLabel::getProductId,params.get("productId").toString());
}
@@ -188,6 +212,9 @@ public class BookLabelAndMarketController {
if (params.containsKey("productName")&&!"".equals(params.get("productName").toString())){
wrapper.like(ShopProduct::getProductName,params.get("productName").toString());
}
if (params.containsKey("goodsType")&&!"".equals(params.get("goodsType").toString())){
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
}
if (params.containsKey("productId")&&!"".equals(params.get("productId").toString())){
wrapper.eq(ShopProductToBookMarket::getProductId,params.get("productId").toString());
}
@@ -245,7 +272,31 @@ public class BookLabelAndMarketController {
return R.ok();
}
@RequestMapping(path = "/delToLable")
public R delToLable(String lableIds) {
if (!StringUtils.isEmpty(lableIds)) {
String[] ids = lableIds.split(",");
if (ids.length>0) {
for (String id : ids) {
toLabelService.removeById(id);
}
}
}
return R.ok();
}
@RequestMapping(path = "/delToMarket")
public R delToMarket(String marketds) {
if (!StringUtils.isEmpty(marketds)) {
String[] ids = marketds.split(",");
if (ids.length>0) {
for (String id : ids) {
toMarketService.removeById(id);
}
}
}
return R.ok();
}