package com.ygj.yuemum.controller.customer; import com.alibaba.fastjson.JSONObject; import com.ygj.yuemum.domain.customer.CustomerCoupon; import com.ygj.yuemum.domain.customer.CustomerCouponQuery; import com.ygj.yuemum.domain.customer.CustomerCouponUpdate; import com.ygj.yuemum.service.customer.CustomerCouponService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; @RestController public class CustomerCouponController { @Autowired private CustomerCouponService customerCouponService; @GetMapping("/getCustomerCoupons") public String getCustomerCoupons(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) { Map customerCoupons = customerCouponService.getCustomerCoupons(page,limit); String jso = JSONObject.toJSONString(customerCoupons); return jso; } @GetMapping("/getAllCustomerCoupons") public List getAllCoupons() { return customerCouponService.getAll(); } @PostMapping("/addCustomerCoupon") public int add(@ModelAttribute CustomerCoupon customerCoupon) { return customerCouponService.addCustomerCoupon(customerCoupon); } @GetMapping("/deleteCustomerCoupon/{id}") public int delete(@PathVariable("id") Integer id) { return customerCouponService.deleteCustomerCoupon(id); } @PostMapping("/updateCustomerCoupon") public int update(@ModelAttribute CustomerCoupon customerCoupon) { return customerCouponService.updateCustomerCoupon(customerCoupon); } @PostMapping("/getCustomerCoupons") public String getCustomerCoupons(@ModelAttribute CustomerCouponQuery customerCouponQuery) { Map customerCoupons = customerCouponService.getCustomerCoupons(customerCouponQuery); String jso = JSONObject.toJSONString(customerCoupons); return jso; } @GetMapping("/getCustomerCoupon/{id}") public CustomerCoupon getOne(@PathVariable("id") Integer id) { return customerCouponService.getCustomerCoupon(id); } @PostMapping("/getCouponSum") public List getCouponSum(@ModelAttribute CustomerCouponQuery customerCouponQuery) { return customerCouponService.getCouponSum(customerCouponQuery); } @PostMapping("/CustomerUseCoupon") public int CustomerUseCoupon(@ModelAttribute CustomerCouponUpdate customerCouponUpdate) { return customerCouponService.CustomerUseCoupon(customerCouponUpdate); } }