package cn.iocoder.yudao.module.app.banner.controller;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.banner.service.DlBaseBannerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * 取banner
 *
 * @author 小李
 * @date 11:05 2024/9/27
**/
@RestController
@RequestMapping("/userClient/banner")
public class BannerAPI {

    @Resource
    private DlBaseBannerService baseBannerService;

    /**
     * 不同小程序用不同的banner，用type分
     *
     * @author 小李
     * @date 11:07 2024/9/27
     * @param type type
    **/
    @GetMapping("/list")
    public CommonResult<?> getBannerByTypeList(@RequestParam("type") String type) {
        return success(baseBannerService.getBannerByTypeList(type));
    }

    @GetMapping("/getById")
    public CommonResult<?> getBannerById(@RequestParam("id") String id) {
        return success(baseBannerService.getBannerById(id));
    }
}
