package com.ruoyi.web.app;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.bst.vip.domain.VipQuery;
import com.ruoyi.bst.vip.domain.enums.VipStatus;
import com.ruoyi.bst.vip.service.VipService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ServiceUtil;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/app/vip")
public class AppVipController extends BaseController {

    @Autowired
    private VipService vipService;

    @ApiOperation("根据运营区查询卡券列表")
    @GetMapping("/listByArea")
    public AjaxResult listByArea(VipQuery query) {
        ServiceUtil.assertion(query.getAreaId() == null, "运营区ID不能为空");
        query.setStatus(VipStatus.ON_SALE.getCode());
        return success(vipService.selectVipList(query));
    }

}
