package com.yonge.cooleshow.student.controller.open;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.microsvc.toolkit.common.response.paging.PageInfo;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.microsvc.toolkit.common.response.template.R;
import com.yonge.cooleshow.biz.dal.service.StudentService;
import com.yonge.cooleshow.biz.dal.service.SysUserService;
import com.yonge.cooleshow.biz.dal.service.UserMusicStarService;
import com.yonge.cooleshow.biz.dal.wrapper.UserMusicStarWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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;

@Slf4j
@Validated
@RestController
@RequestMapping("${app-config.url.student:}/open/userMusicStar")
@Api(tags = "用户曲目作品点赞记录")
public class OpenUserMusicStarController {

    @Autowired
    private UserMusicStarService userMusicStarService;

    @Autowired
    private StudentService studentService;

    @Autowired
    private SysUserService sysUserService;


    @ApiOperation(value = "查询分页", notes = "用户曲目作品点赞记录- 传入 UserMusicStarWrapper.UserMusicStarQuery")
    @PostMapping("/page")
    public R<PageInfo<UserMusicStarWrapper.UserMusicStar>> page(@RequestBody @Validated UserMusicStarWrapper.UserMusicStarQuery query) {

        IPage<UserMusicStarWrapper.UserMusicStar> pages = userMusicStarService.selectPage(QueryInfo.getPage(query), query);

        return R.from(QueryInfo.pageInfo(pages));
    }
}
