优惠券 删除

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 @DeleteMapping
@ApiOperation("删除") @ApiOperation("删除")
public ResponseEntity<Object> delete(@RequestParam("id") Integer id) { public ResponseEntity<Object> delete(@RequestBody Integer[] ids) {
tbShopCouponService.delete(id); tbShopCouponService.delete(ids);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
} }

View File

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

View File

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