优惠券 删除

This commit is contained in:
wangw 2024-10-26 11:23:50 +08:00
parent 84a2007b26
commit 065772c2c3
3 changed files with 8 additions and 6 deletions

View File

@ -70,8 +70,8 @@ public class TbShopCouponController {
@DeleteMapping
@ApiOperation("删除")
public ResponseEntity<Object> delete(@RequestParam("id") Integer id) {
tbShopCouponService.delete(id);
public ResponseEntity<Object> delete(@RequestBody Integer[] ids) {
tbShopCouponService.delete(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -26,7 +26,7 @@ public interface TbShopCouponService extends IService<TbShopCoupon> {
TbShopCoupon findById (Integer id);
boolean update(TbShopCouponVo param);
boolean delete(Integer id);
boolean delete(Integer[] ids);
ResponseEntity<Object> find(CouponDto param);

View File

@ -133,9 +133,11 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
}
@Override
public boolean delete(Integer id) {
tbShopCouponmapper.deleteById(id);
couProductService.remove(new LambdaQueryWrapper<TbCouponProduct>().eq(TbCouponProduct::getCouponId, id));
public boolean delete(Integer[] ids) {
tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids));
for (Integer id : ids) {
couProductService.remove(new LambdaQueryWrapper<TbCouponProduct>().eq(TbCouponProduct::getCouponId, id));
}
return true;
}