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.SysTeacherStuTalkMaterials;
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.SysTeacherVisitDormitoryMaterials;
import com.srs.teacher.service.ISysTeacherVisitDormitoryMaterialsService;
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-05
 */
@RestController
@RequestMapping("/teacher/visitDormitoryMaterials")
@Api(value = "每周深入学生宿舍佐证材料管理", tags = "每周深入学生宿舍佐证材料管理")
public class SysTeacherVisitDormitoryMaterialsController extends BaseController {
    @Autowired
    private ISysTeacherVisitDormitoryMaterialsService sysTeacherVisitDormitoryMaterialsService;

    /**
     * 查询每周深入学生宿舍佐证材料列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:list')")
    @GetMapping("/list")
    @ApiOperation("查询每周深入学生宿舍佐证材料列表")
    public TableDataInfo list(SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        startPage();
        List<SysTeacherVisitDormitoryMaterials> list = sysTeacherVisitDormitoryMaterialsService.selectSysTeacherVisitDormitoryMaterialsList(sysTeacherVisitDormitoryMaterials);
        return getDataTable(list);
    }

    /**
     * 根据辅导员名称、年份 月份 查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:list')")
    @GetMapping("/getByFdyNameAndYearAndMonth")
    @ApiOperation("根据名称年月查询与带班学生谈心谈话列表")
    public TableDataInfo getByFdyNameAndYearAndMonth(@RequestParam String fdyName, @RequestParam String fillingYear, @RequestParam String fillingMonth) {
        startPage();
        List<SysTeacherVisitDormitoryMaterials> list = sysTeacherVisitDormitoryMaterialsService.selectSysTeacherVisitDormitoryMaterialsByFdyName(fdyName, fillingYear, fillingMonth);
        return getDataTable(list);
    }

    /**
     * 导出每周深入学生宿舍佐证材料列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:export')")
    @Log(title = "每周深入学生宿舍佐证材料", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出每周深入学生宿舍佐证材料列表")
    public void export(HttpServletResponse response, SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        List<SysTeacherVisitDormitoryMaterials> list = sysTeacherVisitDormitoryMaterialsService.selectSysTeacherVisitDormitoryMaterialsList(sysTeacherVisitDormitoryMaterials);
        ExcelUtil<SysTeacherVisitDormitoryMaterials> util = new ExcelUtil<SysTeacherVisitDormitoryMaterials>(SysTeacherVisitDormitoryMaterials.class);
        util.exportExcel(response, list, "每周深入学生宿舍佐证材料数据");
    }

    /**
     * 获取每周深入学生宿舍佐证材料详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取每周深入学生宿舍佐证材料详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(sysTeacherVisitDormitoryMaterialsService.selectSysTeacherVisitDormitoryMaterialsById(id));
    }

    /**
     * 新增每周深入学生宿舍佐证材料
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:add')")
    @Log(title = "每周深入学生宿舍佐证材料", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增每周深入学生宿舍佐证材料")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult add(@RequestBody SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        return toAjax(sysTeacherVisitDormitoryMaterialsService.insertSysTeacherVisitDormitoryMaterials(sysTeacherVisitDormitoryMaterials));
    }

    /**
     * 修改每周深入学生宿舍佐证材料
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:edit')")
    @Log(title = "每周深入学生宿舍佐证材料", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改每周深入学生宿舍佐证材料")
    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
    public AjaxResult edit(@RequestBody SysTeacherVisitDormitoryMaterials sysTeacherVisitDormitoryMaterials) {
        return toAjax(sysTeacherVisitDormitoryMaterialsService.updateSysTeacherVisitDormitoryMaterials(sysTeacherVisitDormitoryMaterials));
    }

    /**
     * 删除每周深入学生宿舍佐证材料
     */
    @PreAuthorize("@ss.hasPermi('teacher:visitDormitoryMaterials:remove')")
    @Log(title = "每周深入学生宿舍佐证材料", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除每周深入学生宿舍佐证材料")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(sysTeacherVisitDormitoryMaterialsService.deleteSysTeacherVisitDormitoryMaterialsByIds(ids));
    }
}
