1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package com.ygj.yuemum.controller.coupon;
- import com.alibaba.fastjson.JSONObject;
- import com.ygj.yuemum.domain.coupon.CouponBatch;
- import com.ygj.yuemum.service.coupon.CouponBatchService;
- import com.ygj.yuemum.service.coupon.CouponCreateService;
- import io.swagger.annotations.Api;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Map;
- @Api(tags = "代金券组相关接口")
- @RestController
- public class CouponBatchController {
- @Autowired
- private CouponBatchService couponBatchService;
- @Autowired
- private CouponCreateService couponCreateService;
- @GetMapping("/getCouponbatchs")
- public String getCouponbatchs(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) {
- Map<String, Object> couponBatchs= couponBatchService.getCouponBatchs(page,limit);
- String jso = JSONObject.toJSONString(couponBatchs);
- return jso;
- }
- @GetMapping("/getAllCouponBatchs")
- public List<CouponBatch> getAllCouponBatchs() {
- return couponBatchService.getAll();
- }
- @GetMapping("/selectCouponBatch")
- public List<CouponBatch> selectCouponBatch() {
- return couponBatchService.selectCouponBatch();
- }
- @PostMapping("/addCouponBatch")
- public int add(@ModelAttribute CouponBatch couponbatch) {
- return couponBatchService.addCouponBatch(couponbatch);
- }
- @GetMapping("/deleteCouponBatch")
- public int delete(@RequestParam("cb_code") String cb_code) {
- if(couponCreateService.checkCouponBatch(cb_code) > 0){
- return 9;
- } else {
- return couponBatchService.deleteCouponBatch(cb_code);
- }
- }
- @PostMapping("/updateCouponBatch")
- public int update(@ModelAttribute CouponBatch couponbatch) {
- return couponBatchService.updateCouponBatch(couponbatch);
- }
- @PostMapping("/getQCouponBatch")
- public String getQCouponBatch(@ModelAttribute CouponBatch couponbatch) {
- Map<String, Object> couponBatchs= couponBatchService.getQCouponBatch(couponbatch);
- String jso = JSONObject.toJSONString(couponBatchs);
- return jso;
- }
- @GetMapping("/getCouponBatch")
- public CouponBatch getOne(@RequestParam("id") Integer id) {
- return couponBatchService.getCouponBatch(id);
- }
- }
|