package com.zc.business.controller;

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

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zc.business.domain.DcInfoBoardVocabulary;
import com.zc.business.service.IDcInfoBoardVocabularyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 情报板敏感字管理Controller
 * 
 * @author ruoyi
 * @date 2024-01-05
 */
@Api(tags = {"情报板敏感字管理"})
@RestController
@RequestMapping("/business/dcInfoBoardVocabulary")
public class DcInfoBoardVocabularyController extends BaseController
{
    @Autowired
    private IDcInfoBoardVocabularyService dcInfoBoardVocabularyService;

    /**
     * 查询情报板敏感字管理列表
     */
    @ApiOperation("查询情报板敏感字管理列表")
//    @PreAuthorize("@ss.hasPermi('business:dcInfoBoardVocabulary:list')")
    @GetMapping("/list")
    public TableDataInfo list(DcInfoBoardVocabulary dcInfoBoardVocabulary)
    {
        startPage();
        List<DcInfoBoardVocabulary> list = dcInfoBoardVocabularyService.selectDcInfoBoardVocabularyList(dcInfoBoardVocabulary);
        return getDataTable(list);
    }

    /**
     * 导出情报板敏感字管理列表
     */
    @ApiOperation("导出情报板敏感字管理列表")
//    @PreAuthorize("@ss.hasPermi('business:dcInfoBoardVocabulary:export')")
    @Log(title = "情报板敏感字管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DcInfoBoardVocabulary dcInfoBoardVocabulary)
    {
        List<DcInfoBoardVocabulary> list = dcInfoBoardVocabularyService.selectDcInfoBoardVocabularyList(dcInfoBoardVocabulary);
        ExcelUtil<DcInfoBoardVocabulary> util = new ExcelUtil<>(DcInfoBoardVocabulary.class);
        util.exportExcel(response, list, "情报板敏感字管理数据");
    }

    /**
     * 获取情报板敏感字管理详细信息
     */
    @ApiOperation("获取情报板敏感字管理详细信息")
//    @PreAuthorize("@ss.hasPermi('business:dcInfoBoardVocabulary:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") @ApiParam(value="id", name="id", required=true) Long id)
    {
        return AjaxResult.success(dcInfoBoardVocabularyService.selectDcInfoBoardVocabularyById(id));
    }

    /**
     * 新增情报板敏感字管理
     */
    @ApiOperation("新增情报板敏感字管理")
//    @PreAuthorize("@ss.hasPermi('business:dcInfoBoardVocabulary:add')")
    @Log(title = "情报板敏感字管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DcInfoBoardVocabulary dcInfoBoardVocabulary)
    {
        return dcInfoBoardVocabularyService.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary);
    }

    /**
     * 修改情报板敏感字管理
     */
    @ApiOperation("修改情报板敏感字管理")
//    @PreAuthorize("@ss.hasPermi('business:dcInfoBoardVocabulary:edit')")
    @Log(title = "情报板敏感字管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DcInfoBoardVocabulary dcInfoBoardVocabulary)
    {
        return dcInfoBoardVocabularyService.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary);
    }

    /**
     * 删除情报板敏感字管理
     */
    @ApiOperation("删除情报板敏感字管理")
//    @PreAuthorize("@ss.hasPermi('business:dcInfoBoardVocabulary:remove')")
    @Log(title = "情报板敏感字管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable @ApiParam(value="id", name="id", required=true) Long id)
    {
        return toAjax(dcInfoBoardVocabularyService.deleteDcInfoBoardVocabularyById(id));
    }

    /**
     * 检查情报板是否含有敏感字
     */
    @ApiOperation("检查情报板是否含有敏感字")
    @GetMapping("/checkBoardContent")
    public AjaxResult checkBoardContent(String content) {
        return dcInfoBoardVocabularyService.checkBoardContent(content);
    }
}