package com.srs.web.controller.system;

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.system.domain.QgzxTeacher;
import com.srs.system.service.IQgzxTeacherService;
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 srs
 * @date 2025-07-14
 */
@RestController
@RequestMapping("/system/qgzxteacher")
@Api(value = "教职工信息管理", tags = "教职工信息管理")
public class QgzxTeacherController extends BaseController {
    @Autowired
    private IQgzxTeacherService qgzxTeacherService;

    /**
     * 查询教职工信息列表
     */
@PreAuthorize("@ss.hasPermi('system:qgzxteacher:list')")
@GetMapping("/list")
@ApiOperation("查询教职工信息列表")
    public TableDataInfo list(QgzxTeacher qgzxTeacher)
    {
        startPage();
        List<QgzxTeacher> list = qgzxTeacherService.selectQgzxTeacherList(qgzxTeacher);
        return getDataTable(list);
    }

    /**
     * 导出教职工信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:qgzxteacher:export')")
    @Log(title = "教职工信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出教职工信息列表")
    public void export(HttpServletResponse response, QgzxTeacher qgzxTeacher)
    {
        List<QgzxTeacher> list = qgzxTeacherService.selectQgzxTeacherList(qgzxTeacher);
        ExcelUtil<QgzxTeacher> util = new ExcelUtil<QgzxTeacher>(QgzxTeacher.class);
        util.exportExcel(response, list, "教职工信息数据");
    }

    /**
     * 获取教职工信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:qgzxteacher:query')")
    @GetMapping(value = "/{teacherId}")
    @ApiOperation("获取教职工信息详细信息")
    public AjaxResult getInfo(@PathVariable("teacherId") Long teacherId)
    {
        return success(qgzxTeacherService.selectQgzxTeacherByTeacherId(teacherId));
    }

    /**
     * 新增教职工信息
     */
    @PreAuthorize("@ss.hasPermi('system:qgzxteacher:add')")
    @Log(title = "教职工信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增教职工信息")
    public AjaxResult add(@RequestBody QgzxTeacher qgzxTeacher)
    {
        return toAjax(qgzxTeacherService.insertQgzxTeacher(qgzxTeacher));
    }

    /**
     * 修改教职工信息
     */
    @PreAuthorize("@ss.hasPermi('system:qgzxteacher:edit')")
    @Log(title = "教职工信息", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改教职工信息")
    public AjaxResult edit(@RequestBody QgzxTeacher qgzxTeacher)
    {
        return toAjax(qgzxTeacherService.updateQgzxTeacher(qgzxTeacher));
    }

    /**
     * 删除教职工信息
     */
    @PreAuthorize("@ss.hasPermi('system:qgzxteacher:remove')")
    @Log(title = "教职工信息", businessType = BusinessType.DELETE)
    @PostMapping("/{teacherIds}")
    @ApiOperation("删除教职工信息")
    public AjaxResult remove(@PathVariable Long[] teacherIds)
    {
        return toAjax(qgzxTeacherService.deleteQgzxTeacherByTeacherIds(teacherIds));
    }
}
