123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- 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<String, Object> customerCoupons = customerCouponService.getCustomerCoupons(page,limit);
- String jso = JSONObject.toJSONString(customerCoupons);
- return jso;
- }
- @GetMapping("/getAllCustomerCoupons")
- public List<CustomerCoupon> 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<String, Object> 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<CustomerCoupon> getCouponSum(@ModelAttribute CustomerCouponQuery customerCouponQuery) {
- return customerCouponService.getCouponSum(customerCouponQuery);
- }
- @PostMapping("/CustomerUseCoupon")
- public int CustomerUseCoupon(@ModelAttribute CustomerCouponUpdate customerCouponUpdate) {
- return customerCouponService.CustomerUseCoupon(customerCouponUpdate);
- }
- }
|