package com.yonge.cooleshow.teacher.controller;

import com.microsvc.toolkit.common.response.template.R;
import com.yonge.cooleshow.biz.dal.service.InstrumentService;
import com.yonge.cooleshow.biz.dal.wrapper.InstrumentWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Validated
@RestController
@RequestMapping("${app-config.url.teacher:}/musicalInstrument")
@Api(tags = "曲目乐器")
public class MusicalInstrumentController {

    @Resource
    private InstrumentService instrumentService;

    @ApiOperation(value = "乐器列表")
    @PostMapping("/list")
    public R<List<InstrumentWrapper.Instrument>> list() {
        InstrumentWrapper.InstrumentQuery query = new InstrumentWrapper.InstrumentQuery();
        query.setEnableFlag(true);
        query.setPage(1);
        query.setRows(1000);
        List<InstrumentWrapper.Instrument> instruments = instrumentService.getList(query);
        return R.from(instruments);
	}

}
