package com.zehong.web.controller.supervision;

import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TWorkSupervisionFeedback;
import com.zehong.system.service.ITWorkSupervisionFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 工作督导反馈Controller
 * 
 * @author zehong
 * @date 2025-08-15
 */
@RestController
@RequestMapping("/system/feedback")
public class TWorkSupervisionFeedbackController extends BaseController
{
    @Autowired
    private ITWorkSupervisionFeedbackService tWorkSupervisionFeedbackService;

    /**
     * 查询工作督导反馈列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TWorkSupervisionFeedback tWorkSupervisionFeedback)
    {
        startPage();
        List<TWorkSupervisionFeedback> list = tWorkSupervisionFeedbackService.selectTWorkSupervisionFeedbackList(tWorkSupervisionFeedback);
        return getDataTable(list);
    }

    /**
     * 导出工作督导反馈列表
     */
    @Log(title = "工作督导反馈", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TWorkSupervisionFeedback tWorkSupervisionFeedback)
    {
        List<TWorkSupervisionFeedback> list = tWorkSupervisionFeedbackService.selectTWorkSupervisionFeedbackList(tWorkSupervisionFeedback);
        ExcelUtil<TWorkSupervisionFeedback> util = new ExcelUtil<TWorkSupervisionFeedback>(TWorkSupervisionFeedback.class);
        return util.exportExcel(list, "工作督导反馈数据");
    }

    /**
     * 获取工作督导反馈详细信息
     */
    @GetMapping(value = "/{feedbackId}")
    public AjaxResult getInfo(@PathVariable("feedbackId") Long feedbackId)
    {
        return AjaxResult.success(tWorkSupervisionFeedbackService.selectTWorkSupervisionFeedbackById(feedbackId));
    }

    /**
     * 新增工作督导反馈
     */
    @Log(title = "工作督导反馈", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TWorkSupervisionFeedback tWorkSupervisionFeedback)
    {
        return toAjax(tWorkSupervisionFeedbackService.insertTWorkSupervisionFeedback(tWorkSupervisionFeedback));
    }

    /**
     * 修改工作督导反馈
     */
    @Log(title = "工作督导反馈", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TWorkSupervisionFeedback tWorkSupervisionFeedback)
    {
        return toAjax(tWorkSupervisionFeedbackService.updateTWorkSupervisionFeedback(tWorkSupervisionFeedback));
    }

    /**
     * 删除工作督导反馈
     */
    @Log(title = "工作督导反馈", businessType = BusinessType.DELETE)
	@DeleteMapping("/{feedbackIds}")
    public AjaxResult remove(@PathVariable Long[] feedbackIds)
    {
        return toAjax(tWorkSupervisionFeedbackService.deleteTWorkSupervisionFeedbackByIds(feedbackIds));
    }
}
