package com.srs.web.controller.teacher;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.srs.common.annotation.RepeatSubmit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;

import com.srs.teacher.domain.SysTeacherKpiFillingGraduationGuidance;
import com.srs.teacher.service.ISysTeacherKpiFillingGraduationGuidanceService;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.enums.BusinessType;
import com.srs.common.annotation.Log;
import com.srs.common.core.page.TableDataInfo;

/**
 * 业绩考核-个人填报-就业指导工作Controller
 *
 * @author
 * @date 2024-06-11
 */
@RestController
@RequestMapping("/teacher/kpiFillingGraduationGuidance")
@Api(value = "业绩考核-个人填报-就业指导工作", tags = "业绩考核-个人填报-就业指导工作")
public class SysTeacherKpiFillingGraduationGuidanceController extends BaseController {
    @Autowired
    private ISysTeacherKpiFillingGraduationGuidanceService sysTeacherKpiFillingGraduationGuidanceService;

    /**
     * 查询业绩考核-个人填报-就业指导工作列表
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:list')")
    @GetMapping("/list")
    @ApiOperation("查询业绩考核-个人填报-就业指导工作列表")
    public TableDataInfo list(SysTeacherKpiFillingGraduationGuidance sysTeacherKpiFillingGraduationGuidance) {
        startPage();
        List<SysTeacherKpiFillingGraduationGuidance> list = sysTeacherKpiFillingGraduationGuidanceService.selectSysTeacherKpiFillingGraduationGuidanceList(sysTeacherKpiFillingGraduationGuidance);
        return getDataTable(list);
    }

    /**
     * 根据辅导员名称、年份 月份 查询详细信息
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:list')")
    @GetMapping(value = "/getByFdyNameAndYearAndMonth")
    @ApiOperation("根据名称年月查询业绩考核-个人填报-就业指导工作列表")
    public TableDataInfo getByFdyNameAndYearAndMonth(@RequestParam String fdyName, @RequestParam String fillingYear, @RequestParam String fillingMonth, @RequestParam(required = false) String classType) {
        startPage();
        List<SysTeacherKpiFillingGraduationGuidance> sysTeacherKpiFillingGraduationGuidanceList = sysTeacherKpiFillingGraduationGuidanceService.selectSysTeacherKpiFillingGraduationGuidanceByFdyName(fdyName, fillingYear, fillingMonth, classType);
        return getDataTable(sysTeacherKpiFillingGraduationGuidanceList);
    }

    /**
     * ……
     * 导出业绩考核-个人填报-就业指导工作列表
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:export')")
    @Log(title = "业绩考核-个人填报-就业指导工作", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出业绩考核-个人填报-就业指导工作列表")
    public void export(HttpServletResponse response, SysTeacherKpiFillingGraduationGuidance sysTeacherKpiFillingGraduationGuidance) {
        List<SysTeacherKpiFillingGraduationGuidance> list = sysTeacherKpiFillingGraduationGuidanceService.selectSysTeacherKpiFillingGraduationGuidanceList(sysTeacherKpiFillingGraduationGuidance);
        ExcelUtil<SysTeacherKpiFillingGraduationGuidance> util = new ExcelUtil<SysTeacherKpiFillingGraduationGuidance>(SysTeacherKpiFillingGraduationGuidance.class);
        util.exportExcel(response, list, "业绩考核-个人填报-就业指导工作数据");
    }

    /**
     * 获取业绩考核-个人填报-就业指导工作详细信息
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取业绩考核-个人填报-就业指导工作详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(sysTeacherKpiFillingGraduationGuidanceService.selectSysTeacherKpiFillingGraduationGuidanceById(id));
    }

    /**
     * 新增业绩考核-个人填报-就业指导工作
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:add')")
    @Log(title = "业绩考核-个人填报-就业指导工作", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增业绩考核-个人填报-就业指导工作")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult add(@RequestBody SysTeacherKpiFillingGraduationGuidance sysTeacherKpiFillingGraduationGuidance) {
        return toAjax(sysTeacherKpiFillingGraduationGuidanceService.insertSysTeacherKpiFillingGraduationGuidance(sysTeacherKpiFillingGraduationGuidance));
    }

    /**
     * 修改业绩考核-个人填报-就业指导工作
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:edit')")
    @Log(title = "业绩考核-个人填报-就业指导工作", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改业绩考核-个人填报-就业指导工作")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult edit(@RequestBody SysTeacherKpiFillingGraduationGuidance sysTeacherKpiFillingGraduationGuidance) {
        return toAjax(sysTeacherKpiFillingGraduationGuidanceService.updateSysTeacherKpiFillingGraduationGuidance(sysTeacherKpiFillingGraduationGuidance));
    }

    /**
     * 删除业绩考核-个人填报-就业指导工作
     */
    // @PreAuthorize("@ss.hasPermi('teacher:kpiFillingGraduationGuidance:remove')")
    @Log(title = "业绩考核-个人填报-就业指导工作", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除业绩考核-个人填报-就业指导工作")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(sysTeacherKpiFillingGraduationGuidanceService.deleteSysTeacherKpiFillingGraduationGuidanceByIds(ids));
    }
}
