CustomerCouponController.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.ygj.yuemum.controller.customer;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.ygj.yuemum.domain.customer.CustomerCoupon;
  4. import com.ygj.yuemum.domain.customer.CustomerCouponQuery;
  5. import com.ygj.yuemum.domain.customer.CustomerCouponUpdate;
  6. import com.ygj.yuemum.service.customer.CustomerCouponService;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.*;
  9. import java.util.List;
  10. import java.util.Map;
  11. @RestController
  12. public class CustomerCouponController {
  13. @Autowired
  14. private CustomerCouponService customerCouponService;
  15. @GetMapping("/getCustomerCoupons")
  16. public String getCustomerCoupons(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) {
  17. Map<String, Object> customerCoupons = customerCouponService.getCustomerCoupons(page,limit);
  18. String jso = JSONObject.toJSONString(customerCoupons);
  19. return jso;
  20. }
  21. @GetMapping("/getAllCustomerCoupons")
  22. public List<CustomerCoupon> getAllCoupons() {
  23. return customerCouponService.getAll();
  24. }
  25. @PostMapping("/addCustomerCoupon")
  26. public int add(@ModelAttribute CustomerCoupon customerCoupon) {
  27. return customerCouponService.addCustomerCoupon(customerCoupon);
  28. }
  29. @GetMapping("/deleteCustomerCoupon/{id}")
  30. public int delete(@PathVariable("id") Integer id) {
  31. return customerCouponService.deleteCustomerCoupon(id);
  32. }
  33. @PostMapping("/updateCustomerCoupon")
  34. public int update(@ModelAttribute CustomerCoupon customerCoupon) {
  35. return customerCouponService.updateCustomerCoupon(customerCoupon);
  36. }
  37. @PostMapping("/getCustomerCoupons")
  38. public String getCustomerCoupons(@ModelAttribute CustomerCouponQuery customerCouponQuery) {
  39. Map<String, Object> customerCoupons = customerCouponService.getCustomerCoupons(customerCouponQuery);
  40. String jso = JSONObject.toJSONString(customerCoupons);
  41. return jso;
  42. }
  43. @GetMapping("/getCustomerCoupon/{id}")
  44. public CustomerCoupon getOne(@PathVariable("id") Integer id) {
  45. return customerCouponService.getCustomerCoupon(id);
  46. }
  47. @PostMapping("/getCouponSum")
  48. public List<CustomerCoupon> getCouponSum(@ModelAttribute CustomerCouponQuery customerCouponQuery) {
  49. return customerCouponService.getCouponSum(customerCouponQuery);
  50. }
  51. @PostMapping("/CustomerUseCoupon")
  52. public int CustomerUseCoupon(@ModelAttribute CustomerCouponUpdate customerCouponUpdate) {
  53. return customerCouponService.CustomerUseCoupon(customerCouponUpdate);
  54. }
  55. }