|
@@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.Min;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 商品优惠券接口
|
|
@@ -37,7 +38,7 @@ public class CouponController {
|
|
|
*/
|
|
|
@PostMapping("/coupon")
|
|
|
public Long addCoupon(@RequestBody @Valid CouponModifyParam param) {
|
|
|
- return this.couponService.addCoupon(param);
|
|
|
+ return this.couponService.saveCoupon(param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -83,4 +84,24 @@ public class CouponController {
|
|
|
public CouponDTO getCoupon(@PathVariable("id") @Min(value = 1, message = "优惠券主键不能小于1") Long id) {
|
|
|
return ResourceUtils.required(this.couponService.getCoupon(id), "优惠券不存在");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改优惠券状态
|
|
|
+ *
|
|
|
+ * @param param 修改参数
|
|
|
+ */
|
|
|
+ @PutMapping("/couponStatus")
|
|
|
+ public void updateCouponStatus(@RequestBody @Valid CouponModifyParam param) {
|
|
|
+ this.couponService.updateCouponStatus(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除优惠券
|
|
|
+ *
|
|
|
+ * @param ids 优惠券主键列表
|
|
|
+ */
|
|
|
+ @PutMapping("/coupon/batchDelete/{ids}")
|
|
|
+ public void batchDeleteCoupon(@PathVariable("ids") List<Long> ids) {
|
|
|
+ this.couponService.batchDeleteCoupon(ids);
|
|
|
+ }
|
|
|
}
|