package com.fs.company.controller.qw;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.qw.domain.QwAutoTagsRules;
import com.fs.qw.service.IQwAutoTagsRulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 自动打标签的规则(主要是 群)Controller
 *
 * @author fs
 * @date 2024-07-20
 */
@RestController
@RequestMapping("/qw/autoTagsRules")
public class QwAutoTagsRulesController extends BaseController
{
    @Autowired
    private IQwAutoTagsRulesService qwAutoTagsRulesService;

    /**
     * 查询自动打标签的规则(主要是 群)列表
     */
    @PreAuthorize("@ss.hasPermi('qw:autoTagsRules:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwAutoTagsRules qwAutoTagsRules)
    {
        startPage();
        List<QwAutoTagsRules> list = qwAutoTagsRulesService.selectQwAutoTagsRulesList(qwAutoTagsRules);
        return getDataTable(list);
    }

    /**
     * 导出自动打标签的规则(主要是 群)列表
     */
    @PreAuthorize("@ss.hasPermi('qw:autoTagsRules:export')")
    @Log(title = "自动打标签的规则(主要是 群)", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwAutoTagsRules qwAutoTagsRules)
    {
        List<QwAutoTagsRules> list = qwAutoTagsRulesService.selectQwAutoTagsRulesList(qwAutoTagsRules);
        ExcelUtil<QwAutoTagsRules> util = new ExcelUtil<QwAutoTagsRules>(QwAutoTagsRules.class);
        return util.exportExcel(list, "自动打标签的规则(主要是 群)数据");
    }

    /**
     * 获取自动打标签的规则(主要是 群)详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:autoTagsRules:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwAutoTagsRulesService.selectQwAutoTagsRulesById(id));
    }

    /**
     * 新增自动打标签的规则(主要是 群)
     */
    @PreAuthorize("@ss.hasPermi('qw:autoTagsRules:add')")
    @Log(title = "自动打标签的规则(主要是 群)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwAutoTagsRules qwAutoTagsRules)
    {
        return toAjax(qwAutoTagsRulesService.insertQwAutoTagsRules(qwAutoTagsRules));
    }

    /**
     * 修改自动打标签的规则(主要是 群)
     */
    @PreAuthorize("@ss.hasPermi('qw:autoTagsRules:edit')")
    @Log(title = "自动打标签的规则(主要是 群)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwAutoTagsRules qwAutoTagsRules)
    {
        return toAjax(qwAutoTagsRulesService.updateQwAutoTagsRules(qwAutoTagsRules));
    }

    /**
     * 删除自动打标签的规则(主要是 群)
     */
    @PreAuthorize("@ss.hasPermi('qw:autoTagsRules:remove')")
    @Log(title = "自动打标签的规则(主要是 群)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwAutoTagsRulesService.deleteQwAutoTagsRulesByIds(ids));
    }
}
