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.SysTeacherKpiFilling;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;

import com.srs.teacher.domain.SysTeacherKpiFillingAuditRecord;
import com.srs.teacher.service.ISysTeacherKpiFillingAuditRecordService;
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-07-01
 */
@RestController
@RequestMapping("/teacher/kpiFillingAuditRecord")
@Api(value = "业绩考核-个人填报-审核记录管理", tags = "业绩考核-个人填报-审核记录管理")
public class SysTeacherKpiFillingAuditRecordController extends BaseController {
    @Autowired
    private ISysTeacherKpiFillingAuditRecordService sysTeacherKpiFillingAuditRecordService;

    /**
     * 查询业绩考核-个人填报-审核记录列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:list')")
    @GetMapping("/list")
    @ApiOperation("查询业绩考核-个人填报-审核记录列表")
    public TableDataInfo list(SysTeacherKpiFillingAuditRecord sysTeacherKpiFillingAuditRecord) {
        startPage();
        List<SysTeacherKpiFillingAuditRecord> list = sysTeacherKpiFillingAuditRecordService.selectSysTeacherKpiFillingAuditRecordList(sysTeacherKpiFillingAuditRecord);
        return getDataTable(list);
    }

    /**
     * 导出业绩考核-个人填报-审核记录列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:export')")
    @Log(title = "业绩考核-个人填报-审核记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出业绩考核-个人填报-审核记录列表")
    public void export(HttpServletResponse response, SysTeacherKpiFillingAuditRecord sysTeacherKpiFillingAuditRecord) {
        List<SysTeacherKpiFillingAuditRecord> list = sysTeacherKpiFillingAuditRecordService.selectSysTeacherKpiFillingAuditRecordList(sysTeacherKpiFillingAuditRecord);
        ExcelUtil<SysTeacherKpiFillingAuditRecord> util = new ExcelUtil<SysTeacherKpiFillingAuditRecord>(SysTeacherKpiFillingAuditRecord.class);
        util.exportExcel(response, list, "业绩考核-个人填报-审核记录数据");
    }

    /**
     * 获取业绩考核-个人填报-审核记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:query')")
    @GetMapping(value = "/{auditRecordId}")
    @ApiOperation("获取业绩考核-个人填报-审核记录详细信息")
    public AjaxResult getInfo(@PathVariable("auditRecordId") Long auditRecordId) {
        return success(sysTeacherKpiFillingAuditRecordService.selectSysTeacherKpiFillingAuditRecordByAuditRecordId(auditRecordId));
    }

    /**
     * 新增业绩考核-个人填报-审核记录
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:add')")
    @Log(title = "业绩考核-个人填报-审核记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增业绩考核-个人填报-审核记录")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult add(@RequestBody SysTeacherKpiFillingAuditRecord sysTeacherKpiFillingAuditRecord) {
        return toAjax(sysTeacherKpiFillingAuditRecordService.insertSysTeacherKpiFillingAuditRecord(sysTeacherKpiFillingAuditRecord));
    }

    /**
     * 批量新增业绩考核-个人填报-审核记录
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:add')")
    @Log(title = "业绩考核-个人填报-审核记录", businessType = BusinessType.UPDATE)
    @PostMapping("/batchInsert")
    @ApiOperation("批量修改业绩考核-个人填报")
    @RepeatSubmit(interval = 2000, message = "请求过于频繁")
    public AjaxResult batchInsertSysTeacherKpiFillingAuditRecord(@RequestBody List<SysTeacherKpiFillingAuditRecord> sysTeacherKpiFillingList) {
        return toAjax(sysTeacherKpiFillingAuditRecordService.insertSysTeacherKpiFillingAuditRecordBatch(sysTeacherKpiFillingList));
    }

    /**
     * 修改业绩考核-个人填报-审核记录
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:edit')")
    @Log(title = "业绩考核-个人填报-审核记录", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改业绩考核-个人填报-审核记录")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult edit(@RequestBody SysTeacherKpiFillingAuditRecord sysTeacherKpiFillingAuditRecord) {
        return toAjax(sysTeacherKpiFillingAuditRecordService.updateSysTeacherKpiFillingAuditRecord(sysTeacherKpiFillingAuditRecord));
    }

    /**
     * 删除业绩考核-个人填报-审核记录
     */
    @PreAuthorize("@ss.hasPermi('teacher:kpiFillingAuditRecord:remove')")
    @Log(title = "业绩考核-个人填报-审核记录", businessType = BusinessType.DELETE)
    @PostMapping("/{auditRecordIds}")
    @ApiOperation("删除业绩考核-个人填报-审核记录")
    public AjaxResult remove(@PathVariable Long[] auditRecordIds) {
        return toAjax(sysTeacherKpiFillingAuditRecordService.deleteSysTeacherKpiFillingAuditRecordByAuditRecordIds(auditRecordIds));
    }
}
