用户优惠券问题

This commit is contained in:
2025-12-05 18:14:10 +08:00
parent 4697510b66
commit 5434f63ee4
5 changed files with 10 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ public interface MkShopCouponRecordMapper extends BaseMapper<MkShopCouponRecord>
List<CouponReceiveVo> queryReceive(@Param("param") QueryReceiveDto param);
List<UserCouponVO> findCouponVOByUser(String name, List<Long> shopUserIds, Integer status);
List<UserCouponVO> findCouponVOByUser(String name, List<Long> shopUserIds, Integer status, Long shopId);
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type, Integer isFood);

View File

@@ -87,8 +87,8 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
}
@Override
public List<UserCouponVO> findByUser(String name, List<Long> shopUserIds, Integer status) {
return getMapper().findCouponVOByUser(name, shopUserIds, status);
public List<UserCouponVO> findByUser(String name, List<Long> shopUserIds, Integer status, Long shopId) {
return getMapper().findCouponVOByUser(name, shopUserIds, status, shopId);
}
@Override

View File

@@ -244,13 +244,14 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
public Page<UserCouponVO> find(Long userId, String name, Long shopId, Integer status) {
Page<Object> page = PageUtil.buildPage();
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
List<Long> shopUserIds = shopUserService.listAs(new QueryWrapper().eq(ShopUser::getUserId, userId)
.eq(ShopUser::getSourceShopId, shopId)
.eq(ShopUser::getMainShopId, mainShopId)
.select(ShopUser::getId), Long.class);
if (CollectionUtil.isNotEmpty(shopUserIds)) {
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
List<UserCouponVO> coupons = recordService.findByUser(name, shopUserIds, status);
List<UserCouponVO> coupons = recordService.findByUser(name, shopUserIds, status, shopId);
for (UserCouponVO coupon : coupons) {
int maxShow = 5;
if (StrUtil.isNotBlank(coupon.getFoods())) {

View File

@@ -72,6 +72,9 @@
<foreach collection="shopUserIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
<if test="shopId != null">
and mk_shop_coupon_record.shop_id = #{shopId}
</if>
<if test="name != null and name != ''">
and mk_shop_coupon_record.name like concat('%', #{name}, '%')
</if>