分店获取自己的商品
This commit is contained in:
@@ -92,7 +92,22 @@ public class MkLimitTimeDiscountServiceImpl extends ServiceImpl<MkLimitTimeDisco
|
|||||||
@Override
|
@Override
|
||||||
public MkLimitTimeDiscount getLimitTimeDiscountByShopId(Long shopId) {
|
public MkLimitTimeDiscount getLimitTimeDiscountByShopId(Long shopId) {
|
||||||
Long mainShopId = shopInfoService.getMainIdByShopId(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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user