package org.jeecg.modules.xcx.coupon.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.modules.xcx.coupon.req.CouponPageReq;
import org.jeecg.modules.xcx.coupon.service.ICouponService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Api(tags = "优惠券接口")
@Slf4j
@RestController
@RequestMapping("/coupon")
public class CouponController {


    @Resource
    private ICouponService couponService;

    @ApiOperation(value = "优惠券分页接口")
    @GetMapping("/page")
    public Result<?> couponPage(HttpServletRequest request , CouponPageReq couponPageReq){
        couponPageReq.setToken(TokenUtils.getTokenByRequest(request));
        return couponService.couponPage(couponPageReq);
    }

}
