取消关联

This commit is contained in:
wangw 2025-09-13 09:30:41 +08:00
parent 0794ac7569
commit 02e5684c0f
3 changed files with 21 additions and 2 deletions

View File

@ -124,11 +124,20 @@ public class ACouponController {
* @param couponId 如果syncId有值 则为syncId 否则为id
*/
@GetMapping("/gifts")
public CzgResult<Page<MkCouponGiftDTO>> getCouponPage(Long couponId) {
public CzgResult<Page<MkCouponGiftDTO>> getCouponGiftPage(Long couponId) {
Page<MkCouponGiftDTO> data = couponGiftService.getCouponGiftPage(couponId);
return CzgResult.success(data);
}
/**
* 通过关联Id取消该券的关联
* @param id /admin/coupon/gifts的 主键Id
*/
@DeleteMapping("/cancelGift")
public CzgResult<Void> cancelGift(Long id) {
couponGiftService.cancelGift(id);
return CzgResult.success();
}
private void asyncToBranchShop(Long id, Integer type) {
long shopId = StpKit.USER.getShopId(0L);

View File

@ -47,6 +47,12 @@ public interface MkCouponGiftService extends IService<MkCouponGift> {
*/
void upCouponGift(Long sourceId, String sourceName, Integer type, List<MkCouponGiftDTO> couponGiftList);
/**
* 通过关联Id取消该关联关系
*/
void cancelGift(Long id);
/**
* 删除关联券
*

View File

@ -5,7 +5,6 @@ import com.czg.market.dto.MkCouponGiftDTO;
import com.czg.market.entity.MkCouponGift;
import com.czg.market.entity.ShopCoupon;
import com.czg.market.service.MkCouponGiftService;
import com.czg.market.service.ShopCouponService;
import com.czg.service.market.mapper.MkCouponGiftMapper;
import com.czg.service.market.mapper.ShopCouponMapper;
import com.czg.utils.PageUtil;
@ -72,6 +71,11 @@ public class MkCouponGiftServiceImpl extends ServiceImpl<MkCouponGiftMapper, MkC
addCouponGift(sourceId, sourceName, type, couponGiftList);
}
@Override
public void cancelGift(Long id) {
removeById(id);
}
@Override
public void deleteJoinCouponGift(Long sourceId, Integer type) {
remove(new QueryWrapper().eq(MkCouponGift::getSourceId, sourceId).eq(MkCouponGift::getType, type));