package com.ym.mec.web.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ym.mec.biz.service.TeacherContractsService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.page.QueryInfo;

@RequestMapping("teacherContract")
@Api(tags = "教师协议服务")
@RestController
public class TeacherContractController extends BaseController {

    @Autowired
    private TeacherContractsService teacherContractsService;

    @ApiOperation(value = "分页查询协议列表")
    @GetMapping("/queryPage")
    @PreAuthorize("@pcs.hasPermissions('teacherContract/queryPage')")
    public Object queryPage(QueryInfo queryInfo) {
        return succeed(teacherContractsService.queryPage(queryInfo));
    }

    @ApiOperation(value = "根据教师编号查询教师协议")
    @GetMapping("/get")
    @ApiParam(value = "教师编号", required = true)
    @PreAuthorize("@pcs.hasPermissions('teacherContract/get')")
    @ApiImplicitParams({@ApiImplicitParam(name = "teacherId", value = "教师编号", required = true, dataType = "Integer")})
    public Object get(Integer teacherId) {
        return succeed(teacherContractsService.queryByUserId(teacherId));
    }
    
}
