package com.ym.mec.web.controller.teacher;

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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ym.mec.biz.dal.entity.TeacherLeaveRecord;
import com.ym.mec.biz.service.TeacherLeaveRecordService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.page.QueryInfo;

@RequestMapping("teacherLeaveRecord")
@Api(tags = "教师请假记录服务")
@RestController
public class TeacherLeaveRecordController extends BaseController {

    @Autowired
    private TeacherLeaveRecordService teacherLeaveRecordService;

    @ApiOperation(value = "新增教师请假记录")
    @PostMapping("/add")
    public Object add(TeacherLeaveRecord teacherLeaveRecord){
        teacherLeaveRecordService.insert(teacherLeaveRecord);
        return succeed();
    }

    @ApiOperation(value = "根据教师请假记录编号查询教师请假记录")
    @GetMapping("/get/{id}")
    public Object get(@ApiParam(value = "教师请假记录编号", required = true) @PathVariable("id") Long id){
        return succeed(teacherLeaveRecordService.get(id));
    }

    @ApiOperation(value = "分页查询教师请假记录列表")
    @GetMapping("/queryPage")
    public Object queryPage(QueryInfo queryInfo){
        return succeed(teacherLeaveRecordService.queryPage(queryInfo));
    }

}
