package com.fs.course.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.course.domain.FsUserCourseComplaintType;
import com.fs.course.service.IFsUserCourseComplaintTypeService;
import com.fs.common.utils.poi.ExcelUtil;

/**
 * 看课投诉类型Controller
 * 
 * @author fs
 * @date 2025-06-04
 */
@RestController
@RequestMapping("/course/userCourseComplaintType")
public class FsUserCourseComplaintTypeController extends BaseController
{
    @Autowired
    private IFsUserCourseComplaintTypeService fsUserCourseComplaintTypeService;

    /**
     * 查询看课投诉类型列表
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:list')")
    @GetMapping("/list")
    public AjaxResult list(FsUserCourseComplaintType fsUserCourseComplaintType)
    {
        List<FsUserCourseComplaintType> list = fsUserCourseComplaintTypeService.selectFsUserCourseComplaintTypeList(fsUserCourseComplaintType);
        return AjaxResult.success(list);
    }

    /**
     * 导出看课投诉类型列表
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:export')")
    @Log(title = "看课投诉类型", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsUserCourseComplaintType fsUserCourseComplaintType)
    {
        List<FsUserCourseComplaintType> list = fsUserCourseComplaintTypeService.selectFsUserCourseComplaintTypeList(fsUserCourseComplaintType);
        ExcelUtil<FsUserCourseComplaintType> util = new ExcelUtil<FsUserCourseComplaintType>(FsUserCourseComplaintType.class);
        return util.exportExcel(list, "看课投诉类型数据");
    }

    /**
     * 获取看课投诉类型详细信息
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:query')")
    @GetMapping(value = "/{complaintTypeId}")
    public AjaxResult getInfo(@PathVariable("complaintTypeId") Long complaintTypeId)
    {
        return AjaxResult.success(fsUserCourseComplaintTypeService.selectFsUserCourseComplaintTypeByComplaintTypeId(complaintTypeId));
    }

    /**
     * 新增看课投诉类型
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:add')")
    @Log(title = "看课投诉类型", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsUserCourseComplaintType fsUserCourseComplaintType)
    {
        return toAjax(fsUserCourseComplaintTypeService.insertFsUserCourseComplaintType(fsUserCourseComplaintType));
    }

    /**
     * 修改看课投诉类型
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:edit')")
    @Log(title = "看课投诉类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsUserCourseComplaintType fsUserCourseComplaintType)
    {
        return toAjax(fsUserCourseComplaintTypeService.updateFsUserCourseComplaintType(fsUserCourseComplaintType));
    }

    /**
     * 删除看课投诉类型
     */
    @PreAuthorize("@ss.hasPermi('course:userCourseComplaintType:remove')")
    @Log(title = "看课投诉类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{complaintTypeIds}")
    public AjaxResult remove(@PathVariable Long[] complaintTypeIds)
    {
        return toAjax(fsUserCourseComplaintTypeService.deleteFsUserCourseComplaintTypeByComplaintTypeIds(complaintTypeIds));
    }
}
