package com.yonge.cooleshow.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.cooleshow.biz.dal.dto.search.PracticeSearch;
import com.yonge.cooleshow.biz.dal.service.PracticeService;
import com.yonge.toolset.mybatis.support.PageUtil;
import com.yonge.cooleshow.biz.dal.vo.PracticeVo;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.toolset.base.page.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pactice")
@Api(value = "陪练课")
public class PracticeController extends BaseController {

    @Autowired
    private PracticeService pacticeService;

    @ApiOperation(value = "陪练课-老师详情")
    @PostMapping("/teacherPactice")
    public HttpResponseResult<PageInfo<PracticeVo>> teacherPactice(@RequestBody PracticeSearch search) {
        IPage<PracticeVo> pages = pacticeService.selectTeacherPactice(PageUtil.getPage(search), search);
        return succeed(PageUtil.pageInfo(pages));
    }

    @ApiOperation(value = "陪练课-学生详情")
    @PostMapping("/studentPactice")
    public HttpResponseResult<PageInfo<PracticeVo>> studentPactice(@RequestBody PracticeSearch search) {
        IPage<PracticeVo> pages = pacticeService.selectStudentPactice(PageUtil.getPage(search), search);
        return succeed(PageUtil.pageInfo(pages));
    }
}