|
@@ -0,0 +1,73 @@
|
|
|
+package com.chelvc.cloud.admin.controller;
|
|
|
+
|
|
|
+import com.chelvc.cloud.vehicle.api.dto.CouponDTO;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.CouponModifyParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.CouponPagingParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.service.CouponService;
|
|
|
+import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
+import com.chelvc.framework.common.model.Pagination;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 商品优惠券接口
|
|
|
+ *
|
|
|
+ * @author liude
|
|
|
+ * @Date 2023/8/29
|
|
|
+ **/
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@ResponseWrapping
|
|
|
+@PreAuthorize("isBusiness('EMPLOYEE')")
|
|
|
+public class CouponController {
|
|
|
+ @DubboReference
|
|
|
+ private CouponService couponService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增商品优惠券
|
|
|
+ *
|
|
|
+ * @param param 新增参数
|
|
|
+ * @return 商品优惠券主键
|
|
|
+ */
|
|
|
+ @PostMapping("/coupon")
|
|
|
+ public Long addCoupon(@RequestBody @Valid CouponModifyParam param) {
|
|
|
+ return this.couponService.addCoupon(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改商品优惠券
|
|
|
+ *
|
|
|
+ * @param id 商品优惠券主键
|
|
|
+ * @param param 修改参数
|
|
|
+ */
|
|
|
+ @PutMapping("/coupon/{id}")
|
|
|
+ public void updateCoupon(@PathVariable("id") @Min(value = 1, message = "商品优惠券主键不能小于1") Long id,
|
|
|
+ @RequestBody @Valid CouponModifyParam param) {
|
|
|
+ this.couponService.updateCoupon(id, param);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除商品优惠券
|
|
|
+ *
|
|
|
+ * @param id 商品优惠券主键
|
|
|
+ */
|
|
|
+ @PutMapping("/coupon/delete/{id}")
|
|
|
+ public void deleteCoupon(@PathVariable("id") @Min(value = 1, message = "商品优惠券主键不能小于1") Long id) {
|
|
|
+ this.couponService.deleteCoupon(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询商品优惠券分页
|
|
|
+ *
|
|
|
+ * @param param 查询参数
|
|
|
+ * @return 商品优惠券分页信息
|
|
|
+ */
|
|
|
+ @GetMapping("/coupon/paging")
|
|
|
+ public Pagination<CouponDTO> getCouponPaging(@Valid CouponPagingParam param) {
|
|
|
+ return this.couponService.getCouponPaging(param);
|
|
|
+ }
|
|
|
+}
|