package cn.iocoder.yudao.module.jx.controller.app;


import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.jx.core.controller.BaseController;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolText;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolSwiperService;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolTextService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.security.PermitAll;
import java.util.List;

/**
 * 驾校公告Controller
 *
 * @author jzy
 * @date 2024-04-16
 */
@RestController
@RequestMapping("/drivingSchool/text")
public class AppDriveSchoolTextController extends BaseController
{
    @Autowired
    private IDriveSchoolTextService driveSchoolTextService;

    @Autowired
    private IDriveSchoolSwiperService driveSchoolSwiperService;

    /**
     * 查询驾校公告列表
     */
    @TenantIgnore
    @GetMapping("/list")
    public CommonResult<IPage<?>> list(DriveSchoolText driveSchoolText)
    {
        Page<DriveSchoolText> page = new Page<>(driveSchoolText.getPageNum(), driveSchoolText.getPageSize());
        IPage<DriveSchoolText> driveSchoolTextIPage = driveSchoolTextService.selectDriveSchoolTextList(driveSchoolText, page);
        return CommonResult.success(driveSchoolTextIPage);
    }


    /**
     * 查询驾校-轮播图列表
     */
    @TenantIgnore
    @PermitAll
    @GetMapping("/swiper/list")
    public CommonResult list(DriveSchoolSwiper driveSchoolSwiper)
    {
        List<DriveSchoolSwiper> list = driveSchoolSwiperService.selectDriveSchoolSwiperList(driveSchoolSwiper);
        return CommonResult.success(list);
    }
}
