package com.yonge.cooleshow.teacher.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.toolset.base.page.PageInfo;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.toolset.mybatis.support.PageUtil;

import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.yonge.cooleshow.biz.dal.vo.PianoRoomBuyRecordVo;
import com.yonge.cooleshow.biz.dal.dto.search.PianoRoomBuyRecordSearch;
import com.yonge.cooleshow.biz.dal.service.PianoRoomBuyRecordService;

@RestController
@RequestMapping("/pianoRoomBuyRecord")
@Api(value = "购买琴房记录表", tags = "购买琴房记录表")
public class PianoRoomBuyRecordController extends BaseController {

    @Autowired
    private PianoRoomBuyRecordService pianoRoomBuyRecordService;

	/**
     * 查询单条
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "详情", notes = "传入id")
    public HttpResponseResult<PianoRoomBuyRecordVo> detail(@PathVariable("id") Long id) {
    	return succeed(pianoRoomBuyRecordService.detail(id));
	}
    
    /**
     * 查询分页
     */
    @PostMapping("/page")
    @ApiOperation(value = "查询分页", notes = "传入pianoRoomBuyRecordSearch")
    public HttpResponseResult<PageInfo<PianoRoomBuyRecordVo>> page(@RequestBody PianoRoomBuyRecordSearch query) {
		IPage<PianoRoomBuyRecordVo> pages = pianoRoomBuyRecordService.selectPage(PageUtil.getPage(query), query);
        return succeed(PageUtil.pageInfo(pages));
	}

}