package com.srs.web.controller.teacher;

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

import com.srs.common.annotation.RepeatSubmit;
import com.srs.teacher.domain.SysTeacherKpiFillingStuMgt;
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.SysTeacherKpiFillingRewardsKpi;
import com.srs.teacher.service.ISysTeacherKpiFillingRewardsKpiService;
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 chc
 * @date 2024-06-12
 */
@RestController
@RequestMapping("/teacher/kpiFillingRewardsKpi")
@Api(value = "业绩考核-个人填报-超工作量奖励绩效管理", tags = "业绩考核-个人填报-超工作量奖励绩效管理")
public class SysTeacherKpiFillingRewardsKpiController extends BaseController {
    @Autowired
    private ISysTeacherKpiFillingRewardsKpiService sysTeacherKpiFillingRewardsKpiService;

    /**
     * 查询业绩考核-个人填报-超工作量奖励绩效列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingRewardsKpi:list')")
    @GetMapping("/list")
    @ApiOperation("查询业绩考核-个人填报-超工作量奖励绩效列表")
    public TableDataInfo list(SysTeacherKpiFillingRewardsKpi sysTeacherKpiFillingRewardsKpi) {
        startPage();
        List<SysTeacherKpiFillingRewardsKpi> list = sysTeacherKpiFillingRewardsKpiService.selectSysTeacherKpiFillingRewardsKpiList(sysTeacherKpiFillingRewardsKpi);
        return getDataTable(list);
    }

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

    /**
     * 导出业绩考核-个人填报-超工作量奖励绩效列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingRewardsKpi:export')")
    @Log(title = "业绩考核-个人填报-超工作量奖励绩效", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出业绩考核-个人填报-超工作量奖励绩效列表")
    public void export(HttpServletResponse response, SysTeacherKpiFillingRewardsKpi sysTeacherKpiFillingRewardsKpi) {
        List<SysTeacherKpiFillingRewardsKpi> list = sysTeacherKpiFillingRewardsKpiService.selectSysTeacherKpiFillingRewardsKpiList(sysTeacherKpiFillingRewardsKpi);
        ExcelUtil<SysTeacherKpiFillingRewardsKpi> util = new ExcelUtil<SysTeacherKpiFillingRewardsKpi>(SysTeacherKpiFillingRewardsKpi.class);
        util.exportExcel(response, list, "业绩考核-个人填报-超工作量奖励绩效数据");
    }

    /**
     * 获取业绩考核-个人填报-超工作量奖励绩效详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingRewardsKpi:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取业绩考核-个人填报-超工作量奖励绩效详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(sysTeacherKpiFillingRewardsKpiService.selectSysTeacherKpiFillingRewardsKpiById(id));
    }

    /**
     * 新增业绩考核-个人填报-超工作量奖励绩效
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingRewardsKpi:add')")
    @Log(title = "业绩考核-个人填报-超工作量奖励绩效", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增业绩考核-个人填报-超工作量奖励绩效")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult add(@RequestBody SysTeacherKpiFillingRewardsKpi sysTeacherKpiFillingRewardsKpi) {
        return toAjax(sysTeacherKpiFillingRewardsKpiService.insertSysTeacherKpiFillingRewardsKpi(sysTeacherKpiFillingRewardsKpi));
    }

    /**
     * 修改业绩考核-个人填报-超工作量奖励绩效
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingRewardsKpi:edit')")
    @Log(title = "业绩考核-个人填报-超工作量奖励绩效", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改业绩考核-个人填报-超工作量奖励绩效")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult edit(@RequestBody SysTeacherKpiFillingRewardsKpi sysTeacherKpiFillingRewardsKpi) {
        return toAjax(sysTeacherKpiFillingRewardsKpiService.updateSysTeacherKpiFillingRewardsKpi(sysTeacherKpiFillingRewardsKpi));
    }

    /**
     * 删除业绩考核-个人填报-超工作量奖励绩效
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingRewardsKpi:remove')")
    @Log(title = "业绩考核-个人填报-超工作量奖励绩效", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除业绩考核-个人填报-超工作量奖励绩效")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(sysTeacherKpiFillingRewardsKpiService.deleteSysTeacherKpiFillingRewardsKpiByIds(ids));
    }
}
