package com.spider.quartz.controller;

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

import com.spider.quartz.domain.ExcelDownloadLog;
import com.spider.quartz.service.IExcelDownloadLogService;
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.spider.common.annotation.Log;
import com.spider.common.core.controller.BaseController;
import com.spider.common.core.domain.AjaxResult;
import com.spider.common.enums.BusinessType;
import com.spider.common.utils.poi.ExcelUtil;
import com.spider.common.core.page.TableDataInfo;

/**
 * 美国、欧盟召回数据excel 下载记录Controller
 * 
 * @author ruoyi
 * @date 2025-11-27
 */
@RestController
@RequestMapping("/quartz/excelLog")
public class ExcelDownloadLogController extends BaseController
{
    @Autowired
    private IExcelDownloadLogService excelDownloadLogService;

    /**
     * 查询美国、欧盟召回数据excel 下载记录列表
     */
    @PreAuthorize("@ss.hasPermi('quartz:excelLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(ExcelDownloadLog excelDownloadLog)
    {
        startPage();
        List<ExcelDownloadLog> list = excelDownloadLogService.selectExcelDownloadLogList(excelDownloadLog);
        return getDataTable(list);
    }

    /**
     * 导出美国、欧盟召回数据excel 下载记录列表
     */
    @PreAuthorize("@ss.hasPermi('quartz:excelLog:export')")
    @Log(title = "美国、欧盟召回数据excel 下载记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ExcelDownloadLog excelDownloadLog)
    {
        List<ExcelDownloadLog> list = excelDownloadLogService.selectExcelDownloadLogList(excelDownloadLog);
        ExcelUtil<ExcelDownloadLog> util = new ExcelUtil<ExcelDownloadLog>(ExcelDownloadLog.class);
        util.exportExcel(response, list, "美国、欧盟召回数据excel 下载记录数据");
    }

    /**
     * 获取美国、欧盟召回数据excel 下载记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('quartz:excelLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(excelDownloadLogService.selectExcelDownloadLogById(id));
    }

    /**
     * 新增美国、欧盟召回数据excel 下载记录
     */
    @PreAuthorize("@ss.hasPermi('quartz:excelLog:add')")
    @Log(title = "美国、欧盟召回数据excel 下载记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ExcelDownloadLog excelDownloadLog)
    {
        return toAjax(excelDownloadLogService.insertExcelDownloadLog(excelDownloadLog));
    }

    /**
     * 修改美国、欧盟召回数据excel 下载记录
     */
    @PreAuthorize("@ss.hasPermi('quartz:excelLog:edit')")
    @Log(title = "美国、欧盟召回数据excel 下载记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ExcelDownloadLog excelDownloadLog)
    {
        return toAjax(excelDownloadLogService.updateExcelDownloadLog(excelDownloadLog));
    }

    /**
     * 删除美国、欧盟召回数据excel 下载记录
     */
    @PreAuthorize("@ss.hasPermi('quartz:excelLog:remove')")
    @Log(title = "美国、欧盟召回数据excel 下载记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(excelDownloadLogService.deleteExcelDownloadLogByIds(ids));
    }
}
