package com.ym.mec.web.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
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 com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
import com.ym.mec.biz.dal.page.TeacherMusicGroupSalaryQueryInfo;
import com.ym.mec.biz.service.TeacherDefaultMusicGroupSalaryService;
import com.ym.mec.common.controller.BaseController;

@RequestMapping("teacherDefaultMusicGroupSalary")
@Api(tags = "教师薪酬服务")
@RestController
public class TeacherDefaultMusicGroupSalaryController extends BaseController {

    @Autowired
    private TeacherDefaultMusicGroupSalaryService teacherDefaultMusicGroupSalaryService;

    @ApiOperation(value = "批量新增、修改教师乐团课薪酬")
    @PostMapping("/batchUpset")
    @PreAuthorize("@pcs.hasPermissions('teacherDefaultMusicGroupSalary/batchUpset')")
    public Object batchUpset(@RequestBody TeacherDefaultMusicGroupSalaryTemp teacherDefaultMusicGroupSalaryTemp) {
        teacherDefaultMusicGroupSalaryService.batchUpset(teacherDefaultMusicGroupSalaryTemp.teacherDefaultMusicGroupSalaries, teacherDefaultMusicGroupSalaryTemp.startDate);
        return succeed();
    }

    @ApiOperation(value = "分页查询教师薪酬")
    @GetMapping("/queryPage")
    @PreAuthorize("@pcs.hasPermissions('teacherDefaultMusicGroupSalary/queryPage')")
    public Object queryPage(TeacherMusicGroupSalaryQueryInfo queryInfo) {
        return succeed(teacherDefaultMusicGroupSalaryService.queryPage(queryInfo));
    }

    static class TeacherDefaultMusicGroupSalaryTemp{
    	
    	private List<TeacherDefaultMusicGroupSalary> teacherDefaultMusicGroupSalaries;
    	
    	private Date startDate;

		public List<TeacherDefaultMusicGroupSalary> getTeacherDefaultMusicGroupSalaries() {
			return teacherDefaultMusicGroupSalaries;
		}

		public void setTeacherDefaultMusicGroupSalaries(List<TeacherDefaultMusicGroupSalary> teacherDefaultMusicGroupSalaries) {
			this.teacherDefaultMusicGroupSalaries = teacherDefaultMusicGroupSalaries;
		}

		public Date getStartDate() {
			return startDate;
		}

		public void setStartDate(Date startDate) {
			this.startDate = startDate;
		}
    }
}
