package com.ylx.home.hot.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylx.common.core.domain.R;
import com.ylx.home.hot.domain.dto.HotRecommendDTO;
import com.ylx.home.hot.domain.vo.HotRecommendVO;
import com.ylx.home.hot.service.HomeHotRecommendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/home/hot")
@Api(tags = {"用户端首页热门推荐"})
@Slf4j
public class HomeHotController {

    @Resource
    private HomeHotRecommendService homeHotRecommendService;

    @PostMapping("/recommend")
    @ApiOperation("用户端热门推荐分页接口")
    public R<Page<HotRecommendVO>> hotRecommend(@Validated @RequestBody HotRecommendDTO dto) {
        Page<HotRecommendVO> hotRecommendPage = this.homeHotRecommendService.getHotRecommendPage(dto);
        return R.ok(hotRecommendPage);
    }

}
