package com.propertyManagement.web.controller.business.api;

import com.propertyManagement.business.domain.bo.WxSlideshowBo;
import com.propertyManagement.business.domain.vo.WxSlideshowVo;
import com.propertyManagement.business.service.IWxSlideshowService;
import com.propertyManagement.common.core.controller.BaseController;
import com.propertyManagement.common.core.domain.R;
import com.propertyManagement.common.enums.IsEnableType;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 轮播图

 *
 * @author liushuai
 * @date 2025-06-09
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/slideshow")
public class ApiWxSlideshowController extends BaseController {

    private final IWxSlideshowService iWxSlideshowService;

    /**
     * 查询轮播图列表
     */
    @GetMapping("/list")
    public R<List<WxSlideshowVo>> listAll(@Validated @NotNull(message = "类型不能为空") Integer type) {
        WxSlideshowBo wxSlideshowBo = new WxSlideshowBo();
        wxSlideshowBo.setIsEnable(IsEnableType.YES.getCode());
        wxSlideshowBo.setType(type);
        return R.ok(iWxSlideshowService.queryList(wxSlideshowBo));
    }
}
