package com.srs.web.controller.routine;

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.routine.domain.RtClassMeetingClass;
import com.srs.routine.service.IRtClassMeetingClassService;
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-04-08
 */
@RestController
@RequestMapping("/routine/class")
@Api(value = "需开班会班级管理", tags = "需开班会班级管理")
public class RtClassMeetingClassController extends BaseController {
    @Autowired
    private IRtClassMeetingClassService rtClassMeetingClassService;

    /**
     * 查询需开班会班级列表
     */
@PreAuthorize("@ss.hasPermi('routine:class:list')")
@GetMapping("/list")
@ApiOperation("查询需开班会班级列表")
    public TableDataInfo list(RtClassMeetingClass rtClassMeetingClass)
    {
        startPage();
        List<RtClassMeetingClass> list = rtClassMeetingClassService.selectRtClassMeetingClassList(rtClassMeetingClass);
        return getDataTable(list);
    }

    /**
     * 导出需开班会班级列表
     */
    @PreAuthorize("@ss.hasPermi('routine:class:export')")
    @Log(title = "需开班会班级", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出需开班会班级列表")
    public void export(HttpServletResponse response, RtClassMeetingClass rtClassMeetingClass)
    {
        List<RtClassMeetingClass> list = rtClassMeetingClassService.selectRtClassMeetingClassList(rtClassMeetingClass);
        ExcelUtil<RtClassMeetingClass> util = new ExcelUtil<RtClassMeetingClass>(RtClassMeetingClass.class);
        util.exportExcel(response, list, "需开班会班级数据");
    }

    /**
     * 获取需开班会班级详细信息
     */
    @PreAuthorize("@ss.hasPermi('routine:class:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取需开班会班级详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(rtClassMeetingClassService.selectRtClassMeetingClassById(id));
    }

    /**
     * 新增需开班会班级
     */
    @PreAuthorize("@ss.hasPermi('routine:class:add')")
    @Log(title = "需开班会班级", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增需开班会班级")
    public AjaxResult add(@RequestBody RtClassMeetingClass rtClassMeetingClass)
    {
        return toAjax(rtClassMeetingClassService.insertRtClassMeetingClass(rtClassMeetingClass));
    }

    /**
     * 修改需开班会班级
     */
    @PreAuthorize("@ss.hasPermi('routine:class:edit')")
    @Log(title = "需开班会班级", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改需开班会班级")
    public AjaxResult edit(@RequestBody RtClassMeetingClass rtClassMeetingClass)
    {
        return toAjax(rtClassMeetingClassService.updateRtClassMeetingClass(rtClassMeetingClass));
    }

    /**
     * 删除需开班会班级
     */
    @PreAuthorize("@ss.hasPermi('routine:class:remove')")
    @Log(title = "需开班会班级", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除需开班会班级")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(rtClassMeetingClassService.deleteRtClassMeetingClassByIds(ids));
    }
}
