bug
This commit is contained in:
@@ -52,6 +52,35 @@ public class ShopProductController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/bindProductAndBookLabel")
|
||||||
|
public R bindProductAndBookLabel(@RequestBody Map<String,String> map){
|
||||||
|
String[] productIds = map.get("productId").split(",");
|
||||||
|
Integer labelId = Integer.valueOf(map.get("labelId"));
|
||||||
|
shopProductService.bindProductAndBookLabel(productIds,labelId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/unbindProductAndBookLabel")
|
||||||
|
public R unbindProductAndBookLabel(@RequestBody Map<String,Integer> map){
|
||||||
|
shopProductService.unbindProductAndBookLabel(map.get("productId"),map.get("labelId"));
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/bindProductAndBookMarket")
|
||||||
|
public R bindProductAndBookMarket(@RequestBody Map<String,String> map){
|
||||||
|
String[] productIds = map.get("productId").split(",");
|
||||||
|
Integer marketId = Integer.valueOf(map.get("marketId"));
|
||||||
|
shopProductService.bindProductAndBookMarket(productIds,marketId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/unbindProductAndBookMarket")
|
||||||
|
public R unbindProductAndBookMarket(@RequestBody Map<String,Integer> map){
|
||||||
|
shopProductService.unbindProductAndBookMarket(map.get("productId"),map.get("marketId"));
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/getProductToLabel")
|
@RequestMapping("/getProductToLabel")
|
||||||
public R getProductToLabel(@RequestBody Map<String,Integer> map){
|
public R getProductToLabel(@RequestBody Map<String,Integer> map){
|
||||||
Map<String, Object> productId = shopProductService.getProductToLabel(map.get("productId"));
|
Map<String, Object> productId = shopProductService.getProductToLabel(map.get("productId"));
|
||||||
|
|||||||
@@ -10,4 +10,12 @@ public interface ShopProductService extends IService<ShopProduct> {
|
|||||||
Map<String,Object> getProductDetail(Integer productId);
|
Map<String,Object> getProductDetail(Integer productId);
|
||||||
|
|
||||||
Map<String,Object> getProductToLabel(Integer productId);
|
Map<String,Object> getProductToLabel(Integer productId);
|
||||||
|
|
||||||
|
void bindProductAndBookLabel(String[] productIds,Integer labelId);
|
||||||
|
|
||||||
|
void unbindProductAndBookLabel(Integer productId,Integer labelId);
|
||||||
|
|
||||||
|
void bindProductAndBookMarket(String[] productIds,Integer marketId);
|
||||||
|
|
||||||
|
void unbindProductAndBookMarket(int productId,int marketId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,48 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bindProductAndBookLabel(String[] productIds, Integer labelId) {
|
||||||
|
for (String id:productIds){
|
||||||
|
//check
|
||||||
|
Integer integer = shopProductToBookLabelDao.selectCount(new LambdaQueryWrapper<ShopProductToBookLabel>().eq(ShopProductToBookLabel::getProductId, Integer.valueOf(id)).eq(ShopProductToBookLabel::getBookLabelId, labelId));
|
||||||
|
if(integer>0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ShopProductToBookLabel shopProductToBookLabel = new ShopProductToBookLabel();
|
||||||
|
shopProductToBookLabel.setBookLabelId(labelId);
|
||||||
|
shopProductToBookLabel.setProductId(Integer.valueOf(id));
|
||||||
|
shopProductToBookLabelDao.insert(shopProductToBookLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unbindProductAndBookLabel(Integer productId, Integer labelId) {
|
||||||
|
ShopProductToBookLabel shopProductToBookLabel = shopProductToBookLabelDao.selectOne(new LambdaQueryWrapper<ShopProductToBookLabel>().eq(ShopProductToBookLabel::getBookLabelId, labelId).eq(ShopProductToBookLabel::getProductId, productId));
|
||||||
|
shopProductToBookLabelDao.deleteById(shopProductToBookLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bindProductAndBookMarket(String[] productIds, Integer marketId) {
|
||||||
|
for (String p:productIds){
|
||||||
|
Integer integer = shopProductToBookMarketDao.selectCount(new LambdaQueryWrapper<ShopProductToBookMarket>().eq(ShopProductToBookMarket::getProductId, Integer.valueOf(p)).eq(ShopProductToBookMarket::getBookMarketId, marketId));
|
||||||
|
if(integer>0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ShopProductToBookMarket shopProductToBookMarket = new ShopProductToBookMarket();
|
||||||
|
shopProductToBookMarket.setProductId(Integer.valueOf(p));
|
||||||
|
shopProductToBookMarket.setBookMarketId(marketId);
|
||||||
|
shopProductToBookMarketDao.insert(shopProductToBookMarket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unbindProductAndBookMarket(int productId, int marketId) {
|
||||||
|
ShopProductToBookMarket shopProductToBookMarket = shopProductToBookMarketDao.selectOne(new LambdaQueryWrapper<ShopProductToBookMarket>().eq(ShopProductToBookMarket::getBookMarketId, marketId).eq(ShopProductToBookMarket::getProductId, productId));
|
||||||
|
shopProductToBookMarketDao.deleteById(shopProductToBookMarket);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getProductToLabel(Integer productId) {
|
public Map<String, Object> getProductToLabel(Integer productId) {
|
||||||
HashMap<String, Object> flag = new HashMap<>();
|
HashMap<String, Object> flag = new HashMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user