通过用户Id 查找优惠券

This commit is contained in:
2025-02-27 17:48:09 +08:00
parent 8ecadc4241
commit acbd346690
3 changed files with 8 additions and 5 deletions

View File

@@ -85,8 +85,11 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
public Page<ShopActivateCouponRecord> find(Long userId, Long orderId, Integer status) {
List<Long> shopUserIds = shopUserService.queryChain().eq(ShopUser::getUserId, userId).select(ShopUser::getId).listAs(Long.class);
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
List<Long> shopUserIds = shopUserService.queryChain()
.eq(ShopUser::getUserId, userId)
.eq(ShopUser::getShopId, shopId)
.select(ShopUser::getId).listAs(Long.class);
if (CollectionUtil.isNotEmpty(shopUserIds)) {
return couponRecordService.findByUser(PageUtil.buildPage(), shopUserIds, status);
}