package com.cyl.h5.controller;

import com.cyl.manager.oth.domain.entity.SlideshowInfo;
import com.cyl.manager.oth.domain.query.SlideshowInfoQuery;
import com.cyl.manager.oth.service.SlideshowInfoService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 轮播图信息Controller
 *
 * @author zcc
 * @date 2024-08-01
 */
@Api(description ="小程序-轮播图信息接口列表")
@RestController
@RequestMapping("/h5/slideshowInfo")
public class H5SlideshowInfoController extends BaseController {
    @Autowired
    private SlideshowInfoService service;


    @ApiOperation("小程序-查询轮播图信息列表")
    @PostMapping("/list")
    public ResponseEntity<Page<SlideshowInfo>> list(@RequestBody SlideshowInfoQuery query, Pageable page) {
        List<SlideshowInfo> list = service.selectList(query, page);
        return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
    }



    @ApiOperation("小程序-获取轮播图信息详细信息")
    @GetMapping(value = "/{id}")
    public ResponseEntity<SlideshowInfo> getInfo(@PathVariable("id") Long id) {
        return ResponseEntity.ok(service.selectById(id));
    }
}
