package com.ruoyi.model.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.ruoyi.model.domain.IndexconfigIcon;
import com.ruoyi.model.service.IIndexconfigIconService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 工作台图标Controller
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@RestController
@RequestMapping("/model/indexConfigIcon")
public class IndexconfigIconController extends BaseController
{
    @Autowired
    private IIndexconfigIconService indexconfigIconService;

    /**
     * 查询工作台图标列表
     */
    @PreAuthorize("@ss.hasPermi('model:indexConfigIcon:list')")
    @GetMapping("/list")
    public TableDataInfo list(IndexconfigIcon indexconfigIcon)
    {
        startPage();
        List<IndexconfigIcon> list = indexconfigIconService.selectIndexconfigIconList(indexconfigIcon);
        return getDataTable(list);
    }

    /**
     * 导出工作台图标列表
     */
    @PreAuthorize("@ss.hasPermi('model:indexConfigIcon:export')")
    @Log(title = "工作台图标", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IndexconfigIcon indexconfigIcon) throws IOException {
        List<IndexconfigIcon> list = indexconfigIconService.selectIndexconfigIconList(indexconfigIcon);
        ExcelUtil<IndexconfigIcon> util = new ExcelUtil<IndexconfigIcon>(IndexconfigIcon.class);
        util.exportExcel(response, list, "工作台图标数据");
    }

    /**
     * 获取工作台图标详细信息
     */
    @PreAuthorize("@ss.hasPermi('model:indexConfigIcon:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(indexconfigIconService.selectIndexconfigIconById(id));
    }

    /**
     * 新增工作台图标
     */
    @PreAuthorize("@ss.hasPermi('model:indexConfigIcon:add')")
    @Log(title = "工作台图标", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody IndexconfigIcon indexconfigIcon)
    {
        return toAjax(indexconfigIconService.insertIndexconfigIcon(indexconfigIcon));
    }

    /**
     * 修改工作台图标
     */
    @PreAuthorize("@ss.hasPermi('model:indexConfigIcon:edit')")
    @Log(title = "工作台图标", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody IndexconfigIcon indexconfigIcon)
    {
        return toAjax(indexconfigIconService.updateIndexconfigIcon(indexconfigIcon));
    }

    /**
     * 删除工作台图标
     */
    @PreAuthorize("@ss.hasPermi('model:indexConfigIcon:remove')")
    @Log(title = "工作台图标", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(indexconfigIconService.deleteIndexconfigIconByIds(ids));
    }
}
