package com.fs.delivery.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
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.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
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 com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.delivery.domain.CtCloudClass;
import com.fs.delivery.service.ICtCloudClassService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 空中课堂内容维护Controller
 * 
 * @author fs
 * @date 2026-02-13
 */
@RestController
@RequestMapping("/delivery/class")
public class CtCloudClassController extends BaseController
{
    @Autowired
    private ICtCloudClassService ctCloudClassService;

    /**
     * 查询空中课堂内容维护列表
     */
    @PreAuthorize("@ss.hasPermi('delivery:class:list')")
    @GetMapping("/list")
    public TableDataInfo list(CtCloudClass ctCloudClass)
    {
        startPage();
        List<CtCloudClass> list = ctCloudClassService.selectCtCloudClassList(ctCloudClass);
        return getDataTable(list);
    }

    /**
     * 导出空中课堂内容维护列表
     */
    @PreAuthorize("@ss.hasPermi('delivery:class:export')")
    @Log(title = "空中课堂内容维护", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CtCloudClass ctCloudClass)
    {
        List<CtCloudClass> list = ctCloudClassService.selectCtCloudClassList(ctCloudClass);
        ExcelUtil<CtCloudClass> util = new ExcelUtil<CtCloudClass>(CtCloudClass.class);
        return util.exportExcel(list, "空中课堂内容维护数据");
    }

    /**
     * 获取空中课堂内容维护详细信息
     */
    @PreAuthorize("@ss.hasPermi('delivery:class:query')")
    @GetMapping(value = "/{cloudClassId}")
    public AjaxResult getInfo(@PathVariable("cloudClassId") Long cloudClassId)
    {
        return AjaxResult.success(ctCloudClassService.selectCtCloudClassByCloudClassId(cloudClassId));
    }

    /**
     * 新增空中课堂内容维护
     */
    @PreAuthorize("@ss.hasPermi('delivery:class:add')")
    @Log(title = "空中课堂内容维护", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CtCloudClass ctCloudClass)
    {
        return toAjax(ctCloudClassService.insertCtCloudClass(ctCloudClass));
    }

    /**
     * 修改空中课堂内容维护
     */
    @PreAuthorize("@ss.hasPermi('delivery:class:edit')")
    @Log(title = "空中课堂内容维护", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CtCloudClass ctCloudClass)
    {
        return toAjax(ctCloudClassService.updateCtCloudClass(ctCloudClass));
    }

    /**
     * 删除空中课堂内容维护
     */
    @PreAuthorize("@ss.hasPermi('delivery:class:remove')")
    @Log(title = "空中课堂内容维护", businessType = BusinessType.DELETE)
	@DeleteMapping("/{cloudClassIds}")
    public AjaxResult remove(@PathVariable Long[] cloudClassIds)
    {
        return toAjax(ctCloudClassService.deleteCtCloudClassByCloudClassIds(cloudClassIds));
    }
}
