package com.mzl.flower.web.pub; import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.content.QueryBannerDTO; import com.mzl.flower.dto.response.content.BannerDTO; import com.mzl.flower.service.content.BannerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; 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; @RestController @RequestMapping("/api/pub/banner") @Api(value = "banner管理-未登录", tags = "banner管理-未登录") @Validated @Slf4j public class PubBannerController extends BaseController { private final BannerService bannerService; public PubBannerController(BannerService bannerService) { this.bannerService = bannerService; } @GetMapping("/page/view") @ApiOperation(value = "详情", notes = "详情") public ResponseEntity> detail(@NotNull(message = "id不能为空") Long id) { return returnData(R.SUCCESS.getCode(),bannerService.detail(id)); } @GetMapping("/list") @ApiOperation(value = "用户端-查询banner", notes = "用户端-查询banner") public ResponseEntity>> queryList(QueryBannerDTO dto) { dto.setStatus(Constants.COMMON_PUBLISH_STATUS.published.name()); return returnData(R.SUCCESS.getCode(), bannerService.queryList(dto)); } }