/*
*  Copyright 2019-2025 Tz
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.front.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.system.domain.BusCarousel;
import me.zhengjie.modules.system.domain.dto.BusCarouselQueryCriteria;
import me.zhengjie.modules.system.service.BusCarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@Slf4j
@RestController("CarouselController")
@RequestMapping("api/front/carousel")
@Api(tags = "微信：轮播图")
public class BusCarouselController {

    @Autowired BusCarouselService busCarouselService;

    @Log("轮播图")
    @ApiOperation(value = "轮播图")
    @GetMapping()
    public ResponseEntity<List<String>> queryBusCarousel(){
        List<BusCarousel> busCarousels = busCarouselService.queryAll(new BusCarouselQueryCriteria());
        List<String> list = busCarousels.stream().map(BusCarousel::getPath).collect(Collectors.toList());
        return new ResponseEntity<>(list,HttpStatus.OK);
    }
}