package com.fs.ad.controller;

import com.fs.ad.domain.AdUploadLog;
import com.fs.ad.service.IAdUploadLogService;
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 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 2025-03-14
 */
@RestController
@RequestMapping("/ad/AdUploadLog")
public class AdUploadLogController extends BaseController
{
    @Autowired
    private IAdUploadLogService adUploadLogService;

    /**
     * 查询百度回传日志列表
     */
    @PreAuthorize("@ss.hasPermi('ad:AdUploadLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdUploadLog adUploadLog)
    {
        startPage();
        List<AdUploadLog> list = adUploadLogService.selectAdUploadLogList(adUploadLog);
        return getDataTable(list);
    }

    /**
     * 导出百度回传日志列表
     */
    @PreAuthorize("@ss.hasPermi('ad:AdUploadLog:export')")
    @Log(title = "百度回传日志", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AdUploadLog adUploadLog)
    {
        List<AdUploadLog> list = adUploadLogService.selectAdUploadLogList(adUploadLog);
        ExcelUtil<AdUploadLog> util = new ExcelUtil<AdUploadLog>(AdUploadLog.class);
        return util.exportExcel(list, "百度回传日志数据");
    }

    /**
     * 获取百度回传日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('ad:AdUploadLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(adUploadLogService.selectAdUploadLogById(id));
    }

    /**
     * 新增百度回传日志
     */
    @PreAuthorize("@ss.hasPermi('ad:AdUploadLog:add')")
    @Log(title = "百度回传日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdUploadLog adUploadLog)
    {
        return toAjax(adUploadLogService.insertAdUploadLog(adUploadLog));
    }

    /**
     * 修改百度回传日志
     */
    @PreAuthorize("@ss.hasPermi('ad:AdUploadLog:edit')")
    @Log(title = "百度回传日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdUploadLog adUploadLog)
    {
        return toAjax(adUploadLogService.updateAdUploadLog(adUploadLog));
    }

    /**
     * 删除百度回传日志
     */
    @PreAuthorize("@ss.hasPermi('ad:AdUploadLog:remove')")
    @Log(title = "百度回传日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(adUploadLogService.deleteAdUploadLogByIds(ids));
    }
}
