package com.ruoyi.api.controller.info;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.FilePathSplicingType;
import com.ruoyi.common.filepathsplicing.FilePathSplicing;
import com.ruoyi.info.ad.domain.vo.AdVo;
import com.ruoyi.info.ad.service.IAdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Validated
@Api(value = "广告控制器", tags = {"广告控制器"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/ad")
public class ApiAdController {

    private final IAdService adService;

    /**
     * 获取广告位的广告
     */
    @FilePathSplicing(type = FilePathSplicingType.RESPONSE)
    @ApiOperation("获取广告位广告")
    @GetMapping("/list/{locationCode}")
    public R<List<AdVo>> list(@PathVariable("locationCode") String locationCode) {
        return R.ok(adService.queryListForApi(locationCode));
    }

}
