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.SysTeacherKpiFillingNegativeList;
import com.srs.teacher.service.ISysTeacherKpiFillingNegativeListService;
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/kpiFillingNegativeList")
@Api(value = "业绩考核-个人填报-负面清单管理", tags = "业绩考核-个人填报-负面清单管理")
public class SysTeacherKpiFillingNegativeListController extends BaseController {
    @Autowired
    private ISysTeacherKpiFillingNegativeListService sysTeacherKpiFillingNegativeListService;

    /**
     * 查询业绩考核-个人填报-负面清单列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:list')")
    @GetMapping("/list")
    @ApiOperation("查询业绩考核-个人填报-负面清单列表")
    public TableDataInfo list(SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
        startPage();
        List<SysTeacherKpiFillingNegativeList> list = sysTeacherKpiFillingNegativeListService.selectSysTeacherKpiFillingNegativeListList(sysTeacherKpiFillingNegativeList);
        return getDataTable(list);
    }

    /**
     * 根据辅导员名称、年份 月份 查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:list')")
    @GetMapping("/getByFdyNameAndYearAndMonth")
    @ApiOperation("根据名称年月查询业绩考核-个人填报-负面清单列表表")
    public TableDataInfo getByFdyNameAndYearAndMonth(@RequestParam String fdyName, @RequestParam String fillingYear, @RequestParam String fillingMonth, @RequestParam(required = false) String classType) {
        startPage();
        List<SysTeacherKpiFillingNegativeList> list = sysTeacherKpiFillingNegativeListService.selectSysTeacherKpiFillingNegativeListByFdyName(fdyName, fillingYear, fillingMonth, classType);
        return getDataTable(list);
    }

    /**
     * 导出业绩考核-个人填报-负面清单列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:export')")
    @Log(title = "业绩考核-个人填报-负面清单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出业绩考核-个人填报-负面清单列表")
    public void export(HttpServletResponse response, SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
        List<SysTeacherKpiFillingNegativeList> list = sysTeacherKpiFillingNegativeListService.selectSysTeacherKpiFillingNegativeListList(sysTeacherKpiFillingNegativeList);
        ExcelUtil<SysTeacherKpiFillingNegativeList> util = new ExcelUtil<SysTeacherKpiFillingNegativeList>(SysTeacherKpiFillingNegativeList.class);
        util.exportExcel(response, list, "业绩考核-个人填报-负面清单数据");
    }

    /**
     * 获取业绩考核-个人填报-负面清单详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取业绩考核-个人填报-负面清单详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(sysTeacherKpiFillingNegativeListService.selectSysTeacherKpiFillingNegativeListById(id));
    }

    /**
     * 新增业绩考核-个人填报-负面清单
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:add')")
    @Log(title = "业绩考核-个人填报-负面清单", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增业绩考核-个人填报-负面清单")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult add(@RequestBody SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
        return toAjax(sysTeacherKpiFillingNegativeListService.insertSysTeacherKpiFillingNegativeList(sysTeacherKpiFillingNegativeList));
    }

    /**
     * 修改业绩考核-个人填报-负面清单
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:edit')")
    @Log(title = "业绩考核-个人填报-负面清单", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改业绩考核-个人填报-负面清单")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult edit(@RequestBody SysTeacherKpiFillingNegativeList sysTeacherKpiFillingNegativeList) {
        return toAjax(sysTeacherKpiFillingNegativeListService.updateSysTeacherKpiFillingNegativeList(sysTeacherKpiFillingNegativeList));
    }

    /**
     * 删除业绩考核-个人填报-负面清单
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingNegativeList:remove')")
    @Log(title = "业绩考核-个人填报-负面清单", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除业绩考核-个人填报-负面清单")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(sysTeacherKpiFillingNegativeListService.deleteSysTeacherKpiFillingNegativeListByIds(ids));
    }
}
