package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.dto.MusicScoreDto;
import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
import com.ym.mec.biz.service.SysMusicScoreService;
import com.ym.mec.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RequestMapping("sysMusicScore")
@Api(tags = "曲库")
@RestController
public class SysMusicScoreController extends BaseController {

    @Autowired
    private SysMusicScoreService sysMusicScoreService;

    @ApiOperation(value = "修改")
    @PostMapping("/update")
    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/update')")
    public Object update(@RequestBody MusicScoreDto musicScoreDto) {
        sysMusicScoreService.updateMusicScore(musicScoreDto);
        return succeed();
    }

    @ApiOperation(value = "新增")
    @PostMapping("/add")
    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/add')")
    public Object add(@RequestBody MusicScoreDto musicScoreDto) {
        sysMusicScoreService.add(musicScoreDto);
        return succeed();
    }

    @ApiOperation(value = "删除")
    @PostMapping("/del")
    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/del')")
    public Object del(Integer id) {
        sysMusicScoreService.del(id);
        return succeed();
    }

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