package com.ym.mec.student.controller;

import com.ym.mec.biz.dal.entity.StudentRegistration;
import com.ym.mec.biz.dal.entity.Subject;
import com.ym.mec.biz.service.StudentRegistrationService;
import com.ym.mec.biz.service.SubjectService;
import com.ym.mec.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("register")
@Api(tags = "乐团注册")
@RestController
public class RegisterController extends BaseController {

    @Autowired
    private StudentRegistrationService studentRegistrationService;
    @Autowired
    private SubjectService subjectService;


    @ApiOperation(value = "新增学生报名信息")
    @PostMapping("/add")
    public Object add(StudentRegistration studentRegistration) {
        studentRegistrationService.insert(studentRegistration);
        return succeed(studentRegistration);
    }

    @ApiOperation(value = "通过乐团编号获取声部列表")
    @GetMapping("/findSubByMusicGroupId")
    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer")})
    public Object findSubByMusicGroupId(Integer musicGroupId) {
        return succeed(subjectService.findSubByMusicGroupId(musicGroupId));
    }
}
