package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment;
import com.ym.mec.biz.dal.enums.ClientTypeEnum;
import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
import com.ym.mec.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RequestMapping("sysMusicScoreAccompaniment")
@Api(tags = "曲库服务")
@RestController
public class SysMusicScoreAccompanimentController extends BaseController {

    @Autowired
    private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;

    @ApiOperation(value = "修改")
    @PostMapping("/update")
    @PreAuthorize("@pcs.hasPermissions('sysMusicScoreAccompaniment/update')")
    public Object update(@RequestBody SysMusicScoreAccompaniment sysMusicScoreAccompaniment) {
        sysMusicScoreAccompanimentService.updateAcc(sysMusicScoreAccompaniment);
        return succeed();
    }

    @ApiOperation(value = "删除")
    @PostMapping("/del/{id}")
    @PreAuthorize("@pcs.hasPermissions('sysMusicScoreAccompaniment/del')")
    public Object del(@ApiParam(value = "收费类型编号", required = true) @PathVariable("id") Integer id) {
        sysMusicScoreAccompanimentService.delete(id);
        return succeed();
    }

    @ApiOperation(value = "分页查询")
    @GetMapping("/queryPage")
    @PreAuthorize("@pcs.hasPermissions('sysMusicScoreAccompaniment/queryPage')")
    public Object queryPage(SysExamSongQueryInfo queryInfo) {
        return succeed(sysMusicScoreAccompanimentService.queryAll(queryInfo));
    }

    @ApiOperation(value = "获取伴奏声部列表")
    @GetMapping("/querySubjectIds")
    public Object querySubjectIds() {
        return succeed(sysMusicScoreAccompanimentService.querySubjectIds());
    }
}
