package com.liquidnet.service.sweet.controller;


import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.entity.SweetArtists;
import com.liquidnet.service.sweet.service.ISweetArtistsService;
import com.liquidnet.service.sweet.vo.SweetArtistsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 艺人表 前端控制器（读 kylin_artist，写已迁移至 admin /kylin/artist）
 * </p>
 *
 * @author liquidnet
 * @since 2021-07-23
 */
@Api(tags = "艺人")
@RestController
@RequestMapping("/sweet-artists")
public class SweetArtistsController {

    @Autowired
    ISweetArtistsService sweetArtistsService;

    @GetMapping("list")
    @ApiOperation("艺人列表")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "page", value = "页数", required = true),
            @ApiImplicitParam(type = "query", dataType = "Integer", name = "size", value = "数量", required = true),
            @ApiImplicitParam(type = "query", dataType = "String", name = "name", value = "艺人姓名 不查询从传递null", required = false),
    })
    public ResponseDto<PageInfo<SweetArtists>> getList(@RequestParam() Integer page,
                                                       @RequestParam() Integer size,
                                                       @RequestParam(required = false) String name) {
        return sweetArtistsService.getList(page, size, name);
    }

    @GetMapping("detail")
    @ApiOperation("艺人详情")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "query", dataType = "String", name = "artistsId", value = "艺人Id", required = true),
    })
    public ResponseDto<SweetArtistsVo> detail(@RequestParam() String artistsId) {
        return sweetArtistsService.detail(artistsId);
    }
}
