package com.srs.web.controller.teacher;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.SysTeacherTakeclass;
import com.srs.teacher.service.ISysTeacherTakeclassService;
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;

/**
 * takeClassController
 *
 * @author srs
 * @date 2024-05-29
 */
@RestController
@RequestMapping("/teacher/takeclass")
@Api(value = "辅导员带班信息管理", tags = "辅导员带班信息管理")
public class SysTeacherTakeclassController extends BaseController {
    @Autowired
    private ISysTeacherTakeclassService sysTeacherTakeclassService;

    /**
     * 查询takeClass列表
     */
@PreAuthorize("@ss.hasPermi('teacher:takeclass:list')")
@GetMapping("/list")
@ApiOperation("查询takeClass列表")
    public TableDataInfo list(SysTeacherTakeclass sysTeacherTakeclass)
    {
        startPage();
        List<SysTeacherTakeclass> list = sysTeacherTakeclassService.selectSysTeacherTakeclassList(sysTeacherTakeclass);
        return getDataTable(list);
    }

    /**
     * 导出takeClass列表
     */
    @PreAuthorize("@ss.hasPermi('teacher:takeclass:export')")
    @Log(title = "takeClass", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出takeClass列表")
    public void export(HttpServletResponse response, SysTeacherTakeclass sysTeacherTakeclass)
    {
        List<SysTeacherTakeclass> list = sysTeacherTakeclassService.selectSysTeacherTakeclassList(sysTeacherTakeclass);
        ExcelUtil<SysTeacherTakeclass> util = new ExcelUtil<SysTeacherTakeclass>(SysTeacherTakeclass.class);
        util.exportExcel(response, list, "takeClass数据");
    }

    /**
     * 获取takeClass详细信息
     */
    @PreAuthorize("@ss.hasPermi('teacher:takeclass:query')")
    @GetMapping(value = "/{takeclassId}")
    @ApiOperation("获取takeClass详细信息")
    public AjaxResult getInfo(@PathVariable("takeclassId") Long takeclassId)
    {
        return success(sysTeacherTakeclassService.selectSysTeacherTakeclassByTakeclassId(takeclassId));
    }

    /**
     * 新增takeClass
     */
    @PreAuthorize("@ss.hasPermi('teacher:takeclass:add')")
    @Log(title = "takeClass", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增takeClass")
    public AjaxResult add(@RequestBody SysTeacherTakeclass sysTeacherTakeclass)
    {
        return toAjax(sysTeacherTakeclassService.insertSysTeacherTakeclass(sysTeacherTakeclass));
    }

    /**
     * 修改takeClass
     */
    @PreAuthorize("@ss.hasPermi('teacher:takeclass:edit')")
    @Log(title = "takeClass", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改takeClass")
    public AjaxResult edit(@RequestBody SysTeacherTakeclass sysTeacherTakeclass)
    {
        return toAjax(sysTeacherTakeclassService.updateSysTeacherTakeclass(sysTeacherTakeclass));
    }

    /**
     * 删除takeClass
     */
    @PreAuthorize("@ss.hasPermi('teacher:takeclass:remove')")
    @Log(title = "takeClass", businessType = BusinessType.DELETE)
    @PostMapping("/{takeclassIds}")
    @ApiOperation("删除takeClass")
    public AjaxResult remove(@PathVariable Long[] takeclassIds)
    {
        return toAjax(sysTeacherTakeclassService.deleteSysTeacherTakeclassByTakeclassIds(takeclassIds));
    }
}
