//package com.backendsys.controller.Cms;
//
//import com.backendsys.aspect.QueryNullCheck;
//import com.backendsys.aspect.QueryNullCheckAspect;
//import com.backendsys.entity.Cms.CmsBannerDTO;
//import com.backendsys.entity.PageDTO;
//import com.backendsys.service.Cms.CmsBannerService;
//import com.backendsys.utils.response.Result;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
///**
// * 幻灯片
// */
//@RestController
//public class CmsBannerController {
//
//    @Autowired
//    private CmsBannerService cmsBannerService;
//
//    @PreAuthorize("@sr.hasPermission('10.1')")
//    @GetMapping("/api/cms/banner/getBanner")
//    public Result getBanner(@Validated PageDTO pageDTO, @Validated CmsBannerDTO cmsBannerDTO) {
//        return Result.success(cmsBannerService.queryBanner(pageDTO.getPage_num(), pageDTO.getPage_size(), cmsBannerDTO));
//    }
//
//    @PreAuthorize("@sr.hasPermission('10.1.1')")
//    @QueryNullCheck(serviceClass = CmsBannerService.class, serviceMethod = "queryBannerDetail", argField = "banner_id", message = "幻灯片不存在")
//    @GetMapping("/api/cms/banner/getBannerDetail")
//    public Result getBannerDetail(@Validated(CmsBannerDTO.Detail.class) CmsBannerDTO cmsBannerDTO) {
//        return Result.success(QueryNullCheckAspect.getQueryResult());
//    }
//
//    @PreAuthorize("@sr.hasPermission('10.1.2')")
//    @PostMapping("/api/cms/banner/createBanner")
//    public Result createBanner(@Validated(CmsBannerDTO.Create.class) @RequestBody CmsBannerDTO cmsBannerDTO) {
//        return Result.success(cmsBannerService.insertBanner(cmsBannerDTO), "创建成功");
//    }
//
//    @PreAuthorize("@sr.hasPermission('10.1.3')")
//    @QueryNullCheck(serviceClass = CmsBannerService.class, serviceMethod = "queryBannerDetail", argField = "banner_id", message = "幻灯片不存在")
//    @PutMapping("/api/cms/banner/updateBanner")
//    public Result updateBanner(@Validated(CmsBannerDTO.Update.class) @RequestBody CmsBannerDTO cmsBannerDTO) {
//        return Result.success(cmsBannerService.updateBanner(cmsBannerDTO), "更新成功");
//    }
//
//    @PreAuthorize("@sr.hasPermission('10.1.4')")
//    @QueryNullCheck(serviceClass = CmsBannerService.class, serviceMethod = "queryBannerDetail", argField = "banner_id", message = "幻灯片不存在")
//    @DeleteMapping("/api/cms/banner/deleteBanner")
//    public Result deleteBanner(@Validated(CmsBannerDTO.Delete.class) @RequestBody CmsBannerDTO cmsBannerDTO) {
//        return Result.success(cmsBannerService.deleteBanner(cmsBannerDTO), "删除成功");
//    }
//
//    /**
//     * 幻灯片列表 (公共)
//     */
//    @GetMapping("/api/public/cms/banner/getBanner")
//    public Result getPublicBanner(@Validated PageDTO pageDTO, @Validated CmsBannerDTO cmsBannerDTO) {
//        cmsBannerDTO.setStatus(1); // 已启用
//        return Result.success(cmsBannerService.queryBanner(pageDTO.getPage_num(), pageDTO.getPage_size(), cmsBannerDTO));
//    }
//
//}
