Browse Source

修复榜单绑定商品删除问题

zyj
sj 2 years ago
parent
commit
2fa9950933
  1. 6
      zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java
  2. 14
      zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java
  3. 16
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

6
zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java

@ -164,6 +164,9 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
wrapper.eq(YxStoreHotListRecord::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
//获取所有评测列表(后期限制一年?)
List<YxStoreHotListRecord> list=yxStoreHotListRecordMapper.selectList(wrapper);
if(list.isEmpty()){
return null;
}
//获取月份
LinkedHashSet<String> mouthList=new LinkedHashSet<>();
list.forEach(yxStoreHotListRecord -> mouthList.add(yxStoreHotListRecord.getMouth()));
@ -253,6 +256,9 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
wrapper.eq(YxStoreHotListRecord::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
//获取所有评测列表(后期限制一年?)
List<YxStoreHotListRecord> list=yxStoreHotListRecordMapper.selectList(wrapper);
if(list.isEmpty()){
return null;
}
//获取月份
LinkedHashSet<String> mouthList=new LinkedHashSet<>();
list.forEach(yxStoreHotListRecord -> mouthList.add(yxStoreHotListRecord.getMouth()));

14
zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java

@ -141,15 +141,15 @@ public class StoreProductController {
//不能删除
throw new YshopException("当前商品已绑定评测,不能被删除");
}
Long count1 = yxStoreHotListMapper
.selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
.eq(YxStoreHotList::getIsShow,1));
// Long count1 = yxStoreHotListMapper
// .selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
// .eq(YxStoreHotList::getIsShow,1));
// .like(YxStoreHotList::getProductList,id));
//此商品被热门榜单绑定,不能删除
if(count1 > 0) {
//不能删除
throw new YshopException("当前商品已绑定热门榜单,不能被删除");
}
// if(count1 > 0) {
// //不能删除
// throw new YshopException("当前商品已绑定热门榜单,不能被删除");
// }
yxStoreProductService.removeById(id);
return new ResponseEntity(HttpStatus.OK);
}

16
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

@ -587,14 +587,14 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
if(count > 0) {
throw new YshopException("当前商品已绑定评测,不能被下架");
}
Long count1 = yxStoreHotListMapper
.selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
.eq(YxStoreHotList::getIsShow,1));
// .like(YxStoreHotList::getProductList,id));
//此商品被热门榜单绑定,不能下架
if(count1 > 0) {
throw new YshopException("当前商品已绑定热门榜单,不能被下架");
}
// Long count1 = yxStoreHotListMapper
// .selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
// .eq(YxStoreHotList::getIsShow,1));
//// .like(YxStoreHotList::getProductList,id));
// //此商品被热门榜单绑定,不能下架
// if(count1 > 0) {
// throw new YshopException("当前商品已绑定热门榜单,不能被下架");
// }
status = ShopCommonEnum.SHOW_0.getValue();
} else {
status = ShopCommonEnum.SHOW_1.getValue();

Loading…
Cancel
Save