package com.ruoyi.system.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SysMenuClick;
import com.ruoyi.system.service.ISysMenuClickService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 菜单点击计数Controller
 * 
 * @author gyt
 * @date 2025-11-12
 */
@RestController
@RequestMapping("/sysMenuClick")
public class SysMenuClickController extends BaseController
{
    @Autowired
    private ISysMenuClickService sysMenuClickService;

    /**
     * 查询菜单点击计数列表
     */
    @RequiresPermissions("system:sysMenuClick:list")
    @GetMapping("/getMenuListTopEight")
    public AjaxResult list()
    {
        List<SysMenuClick> list = sysMenuClickService.selectSysMenuClickList();
        return success(list);
    }
    /**
     * 新增菜单点击计数
     */
    @RequiresPermissions("system:sysMenuClick:add")
    @Log(title = "菜单点击计数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysMenuClick sysMenuClick)
    {
        return toAjax(sysMenuClickService.insertSysMenuClick(sysMenuClick));
    }
}
