package cn.iocoder.yudao.module.inspection.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.entity.InspectionNewsComment;
import cn.iocoder.yudao.module.inspection.service.IInspectionNewsCommentService;
import cn.iocoder.yudao.util.ExcelUtil;
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 cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2023-08-07
 */
@RestController
@RequestMapping("/admin-api/system/comment")
public class InspectionNewsCommentController extends BaseController
{
    @Autowired
    private IInspectionNewsCommentService inspectionNewsCommentService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:comment:list')")
    @GetMapping("/list")
    public TableDataInfo list(InspectionNewsComment inspectionNewsComment)
    {
        startPage();
        List<InspectionNewsComment> list = inspectionNewsCommentService.selectInspectionNewsCommentList(inspectionNewsComment);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:comment:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, InspectionNewsComment inspectionNewsComment)
    {
        List<InspectionNewsComment> list = inspectionNewsCommentService.selectInspectionNewsCommentList(inspectionNewsComment);
        ExcelUtil<InspectionNewsComment> util = new ExcelUtil<InspectionNewsComment>(InspectionNewsComment.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:comment:query')")
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(inspectionNewsCommentService.selectInspectionNewsCommentById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:comment:add')")
    @PostMapping
    public CommonResult add(@RequestBody InspectionNewsComment inspectionNewsComment)
    {
        return toAjax(inspectionNewsCommentService.insertInspectionNewsComment(inspectionNewsComment));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:comment:edit')")
    @PutMapping
    public CommonResult edit(@RequestBody InspectionNewsComment inspectionNewsComment)
    {
        return toAjax(inspectionNewsCommentService.updateInspectionNewsComment(inspectionNewsComment));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:comment:remove')")
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(inspectionNewsCommentService.deleteInspectionNewsCommentByIds(ids));
    }
}
