package com.yonge.cooleshow.teacher.controller;

import com.yonge.cooleshow.biz.dal.dto.search.PianoRoomSettingsSearch;
import com.yonge.cooleshow.biz.dal.service.PianoRoomSettingsService;
import com.yonge.cooleshow.biz.dal.vo.PianoRoomSettingsVo;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.cooleshow.common.enums.YesOrNoEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/pianoRoomSettings")
@Api(value = "琴房时长价格配置", tags = "琴房时长价格配置")
public class PianoRoomSettingsController extends BaseController {

    @Autowired
    private PianoRoomSettingsService pianoRoomSettingsService;

    /**
     * 查询单条
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "详情", notes = "传入id")
    public HttpResponseResult<PianoRoomSettingsVo> detail(@PathVariable("id") Long id) {
        return succeed(pianoRoomSettingsService.detail(id));
    }

    @PostMapping("/list")
    @ApiOperation(value = "查询列表")
    public HttpResponseResult<List<PianoRoomSettingsVo>> list(@RequestBody PianoRoomSettingsSearch query) {
        query.setStatus(YesOrNoEnum.YES.getCode());
        List<PianoRoomSettingsVo> list = pianoRoomSettingsService.selectList(query);
        return succeed(list);
    }
}