分店获取自己的商品

This commit is contained in:
wangw 2025-10-31 16:30:29 +08:00
parent 2123606bf5
commit 5bb1e28310
1 changed files with 16 additions and 1 deletions

View File

@ -92,7 +92,22 @@ public class MkLimitTimeDiscountServiceImpl extends ServiceImpl<MkLimitTimeDisco
@Override
public MkLimitTimeDiscount getLimitTimeDiscountByShopId(Long shopId) {
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
return mapper.selectOneByShopId(mainShopId, shopId, CzgStrUtils.getStrWeek());
MkLimitTimeDiscount limitTimeDiscount = mapper.selectOneByShopId(mainShopId, shopId, CzgStrUtils.getStrWeek());
if (limitTimeDiscount != null && limitTimeDiscount.getFoodType() == 2 && StrUtil.isNotBlank(limitTimeDiscount.getFoods())) {
List<String> foodIds = Arrays.stream(limitTimeDiscount.getFoods().split(","))
.map(String::trim)
.filter(StrUtil::isNotBlank)
.distinct()
.toList();
List<String> ids = productService.listAs(QueryWrapper.create().select(Product::getId)
.eq(Product::getShopId, shopId).in(Product::getSyncId, foodIds), String.class);
if (CollUtil.isEmpty(ids)) {
limitTimeDiscount.setFoods("");
} else {
limitTimeDiscount.setFoods(String.join(",", ids));
}
}
return limitTimeDiscount;
}
@Override