
package com.tmerclub.cloud.multishop.controller.app;

import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.service.IndexImgService;
import com.tmerclub.cloud.multishop.vo.IndexImgVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 轮播图
 *
 * @author YXF
 * @date 2020-11-24 16:38:32
 */
@RestController("appIndexImgController")
@RequestMapping("/ua/indexPic")
@Tag(name = "app-轮播图")
public class IndexImgController {

    @Autowired
    private IndexImgService indexImgService;

    @GetMapping("/list")
    @Operation(summary = "获取轮播图列表", description = "分页获取轮播图列表")
    @Parameters({
            @Parameter(name = "shopId", description = "店铺id（平台：0）"),
            @Parameter(name = "imgType", description = "图片类型,0app,1pc")
    })
    public ServerResponseEntity<List<IndexImgVO>> getList(@RequestParam("shopId") Long shopId, @RequestParam("imgType") Integer imgType) {
        List<IndexImgVO> indexImgPage = indexImgService.getListByShopId(shopId, imgType);
        return ServerResponseEntity.success(indexImgPage);
    }
}
