This commit is contained in:
wangjinlei
2024-05-08 17:52:21 +08:00
parent 4db86fadde
commit e749b9d9b2
3 changed files with 154 additions and 4 deletions

View File

@@ -69,8 +69,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
@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);
shopProductToBookLabelDao.delete(new LambdaQueryWrapper<ShopProductToBookLabel>().eq(ShopProductToBookLabel::getBookLabelId, labelId).eq(ShopProductToBookLabel::getProductId, productId));
}
@Override
@@ -89,8 +88,84 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
@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);
shopProductToBookMarketDao.delete(new LambdaQueryWrapper<ShopProductToBookMarket>().eq(ShopProductToBookMarket::getBookMarketId, marketId).eq(ShopProductToBookMarket::getProductId, productId));
}
@Override
public void bindProductAndSociologyLabel(String[] productIds, Integer labelId) {
for (String p : productIds){
Integer integer = shopProductToSociologyLabelDao.selectCount(new LambdaQueryWrapper<ShopProductToSociologyLabel>().eq(ShopProductToSociologyLabel::getProductId, Integer.valueOf(p)).eq(ShopProductToSociologyLabel::getSociologyLabelId, labelId));
if(integer>0){
continue;
}
ShopProductToSociologyLabel shopProductToSociologyLabel = new ShopProductToSociologyLabel();
shopProductToSociologyLabel.setProductId(Integer.valueOf(p));
shopProductToSociologyLabel.setSociologyLabelId(labelId);
shopProductToSociologyLabelDao.insert(shopProductToSociologyLabel);
}
}
@Override
public void unbindProductAndSociologyLabel(int productId, int labelId) {
shopProductToSociologyLabelDao.delete(new LambdaQueryWrapper<ShopProductToSociologyLabel>().eq(ShopProductToSociologyLabel::getProductId, productId).eq(ShopProductToSociologyLabel::getSociologyLabelId, labelId));
}
@Override
public void bindProductAndSociologyMarket(String[] productId, int marketId) {
for (String p:productId){
Integer integer = shopProductToSociologyMarketDao.selectCount(new LambdaQueryWrapper<ShopProductToSociologyMarket>().eq(ShopProductToSociologyMarket::getProductId, Integer.valueOf(p)).eq(ShopProductToSociologyMarket::getSociologyMarketId, marketId));
if(integer>0){
continue;
}
ShopProductToSociologyMarket shopProductToSociologyMarket = new ShopProductToSociologyMarket();
shopProductToSociologyMarket.setProductId(Integer.valueOf(p));
shopProductToSociologyMarket.setSociologyMarketId(marketId);
shopProductToSociologyMarketDao.insert(shopProductToSociologyMarket);
}
}
@Override
public void unbindProductAndSociologyMarket(int product, int marketId) {
shopProductToSociologyMarketDao.delete(new LambdaQueryWrapper<ShopProductToSociologyMarket>().eq(ShopProductToSociologyMarket::getProductId,product).eq(ShopProductToSociologyMarket::getSociologyMarketId,marketId));
}
@Override
public void bindProductAndMedicineLabel(String[] productId, int labelId) {
for (String p : productId){
Integer integer = shopProductToMedicineLabelDao.selectCount(new LambdaQueryWrapper<ShopProductToMedicineLabel>().eq(ShopProductToMedicineLabel::getProductId, Integer.valueOf(p)).eq(ShopProductToMedicineLabel::getMedicineLabelId, labelId));
if(integer>0){
continue;
}
ShopProductToMedicineLabel shopProductToMedicineLabel = new ShopProductToMedicineLabel();
shopProductToMedicineLabel.setProductId(Integer.valueOf(p));
shopProductToMedicineLabel.setMedicineLabelId(labelId);
shopProductToMedicineLabelDao.insert(shopProductToMedicineLabel);
}
}
@Override
public void unbindProductAndMedicineLabel(int productId, int labelId) {
shopProductToMedicineLabelDao.delete(new LambdaQueryWrapper<ShopProductToMedicineLabel>().eq(ShopProductToMedicineLabel::getMedicineLabelId,labelId).eq(ShopProductToMedicineLabel::getProductId,productId));
}
@Override
public void bindProductAndMedicineMarket(String[] productId, int marketId) {
for (String p:productId){
Integer integer = shopProductToMedicineMarketDao.selectCount(new LambdaQueryWrapper<ShopProductToMedicineMarket>().eq(ShopProductToMedicineMarket::getProductId, Integer.valueOf(p)).eq(ShopProductToMedicineMarket::getMedicineMarketId, marketId));
if(integer>0){
continue;
}
ShopProductToMedicineMarket shopProductToMedicineMarket = new ShopProductToMedicineMarket();
shopProductToMedicineMarket.setProductId(Integer.valueOf(p));
shopProductToMedicineMarket.setMedicineMarketId(marketId);
shopProductToMedicineMarketDao.insert(shopProductToMedicineMarket);
}
}
@Override
public void unbindProductAndMedicineMarket(int productId, int marketId) {
shopProductToMedicineMarketDao.delete(new LambdaQueryWrapper<ShopProductToMedicineMarket>().eq(ShopProductToMedicineMarket::getMedicineMarketId,marketId).eq(ShopProductToMedicineMarket::getProductId,productId));
}
@Override