package com.ruoyi.app.pay;

import java.util.List;
import jakarta.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.system.domain.IpnLog;
import com.ruoyi.system.service.IIpnLogService;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * IpnLogController
 *
 * @author ruoyi
 * @date 2023-11-22
 */
@RestController
@RequestMapping("/system/ipnlog")
public class IpnLogController extends BaseController
{
    @Autowired
    private IIpnLogService ipnLogService;

    /**
     * 查询IpnLog列表
     */
    @PreAuthorize("@ss.hasPermi('system:ipnlog:list')")
    @GetMapping("/list")
    public TableDataInfo list(IpnLog ipnLog)
    {
        startPage();
        List<IpnLog> list = ipnLogService.selectIpnLogList(ipnLog);
        return getDataTable(list);
    }

    /**
     * 导出IpnLog列表
     */
    @PreAuthorize("@ss.hasPermi('system:ipnlog:export')")
    @Log(title = "IpnLog", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IpnLog ipnLog)
    {
        List<IpnLog> list = ipnLogService.selectIpnLogList(ipnLog);
        ExcelUtil<IpnLog> util = new ExcelUtil<IpnLog>(IpnLog.class);
        util.exportExcel(response, list, MessageUtils.message("no.export.excel.ipnlog"));
    }

    /**
     * 获取IpnLog详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ipnlog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ipnLogService.selectIpnLogById(id));
    }

    /**
     * 新增IpnLog
     */
    @PreAuthorize("@ss.hasPermi('system:ipnlog:add')")
    @Log(title = "IpnLog", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody IpnLog ipnLog)
    {
        return toAjax(ipnLogService.insertIpnLog(ipnLog));
    }

    /**
     * 修改IpnLog
     */
    @PreAuthorize("@ss.hasPermi('system:ipnlog:edit')")
    @Log(title = "IpnLog", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody IpnLog ipnLog)
    {
        return toAjax(ipnLogService.updateIpnLog(ipnLog));
    }

    /**
     * 删除IpnLog
     */
    @PreAuthorize("@ss.hasPermi('system:ipnlog:remove')")
    @Log(title = "IpnLog", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ipnLogService.deleteIpnLogByIds(ids));
    }
}
