|
@@ -0,0 +1,60 @@
|
|
|
|
+package com.xynet.marketing.controller.merc;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.xynet.marketing.service.MercCouponService;
|
|
|
|
+import com.xynet.marketing.utils.MercAuthUtils;
|
|
|
|
+import com.xynet.marketing.utils.R;
|
|
|
|
+import com.xynet.marketing.utils.collections.map.JHashMap;
|
|
|
|
+import com.xynet.marketing.utils.collections.map.JMap;
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 商户端优惠券控制器
|
|
|
|
+ *
|
|
|
|
+ * @author hechunping
|
|
|
|
+ * @date 2025/2/14
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("merc/coupon")
|
|
|
|
+@AllArgsConstructor
|
|
|
|
+@Slf4j
|
|
|
|
+public class MercCouponController {
|
|
|
|
+ private final MercCouponService mercCouponService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分页查询
|
|
|
|
+ *
|
|
|
|
+ * @param param
|
|
|
|
+ * @param headers
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("page")
|
|
|
|
+ private R page(@RequestBody Map<String, Object> param, @RequestHeader Map<String, String> headers) {
|
|
|
|
+ Integer mercId = MercAuthUtils.getMercId(headers);
|
|
|
|
+ JMap<String, Object> jParam = new JHashMap<>(param);
|
|
|
|
+ jParam.put("mercId", mercId);
|
|
|
|
+ Page<Map<String, Object>> data = mercCouponService.page(jParam);
|
|
|
|
+ return R.ok(data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增与修改
|
|
|
|
+ *
|
|
|
|
+ * @param param
|
|
|
|
+ * @param headers
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("saveOrUpdate")
|
|
|
|
+ private R saveOrUpdate(@RequestBody Map<String, Object> param, @RequestHeader Map<String, String> headers) {
|
|
|
|
+ Integer mercId = MercAuthUtils.getMercId(headers);
|
|
|
|
+ JMap<String, Object> jParam = new JHashMap<>(param);
|
|
|
|
+ jParam.put("mercId", mercId);
|
|
|
|
+ return R.ok(mercCouponService.saveOrUpdate(jParam));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|