package com.hc.web.controller.browser.front;

import com.hc.business.service.ZccmBannerService;
import com.hc.core.utils.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;


/**
 * 广告表
 * (ZccmBanner)表控制层
 *
 * @author java
 * @since 2020-11-26 09:29:54
 */

@RestController
@RequestMapping("/new/api/front/banner")
public class FrontBannerController {

    /**
     * 服务对象
     */
    private final ZccmBannerService bannerService;

    public FrontBannerController(ZccmBannerService bannerService) {
        this.bannerService = bannerService;
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "依据主键获取 ZccmBanner", response = Result.class)
    public Result selectFrontDetail(@PathVariable("id") Integer id) {
        return Result.success(this.bannerService.queryById(id));
    }

    @GetMapping("/list")
    @ApiOperation(value = "获取 ZccmBanner列表(分页)", response = Result.class)
    public Result listFrontBanner(@RequestParam(defaultValue = "0") Integer page,
                                  @RequestParam(defaultValue = "0") Integer size) {
        return Result.success(bannerService.queryAllByLimit(page, size));
    }


}