package com.ruoyi.system.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
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.EpsMethodChangeRecord;
import com.ruoyi.system.service.IEpsMethodChangeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * 收益方式修改记录Controller
 *
 * @author gyt
 * @date 2025-08-19
 */
@RestController
@RequestMapping("/record")
public class EpsMethodChangeRecordController extends BaseController
{
    @Autowired
    private IEpsMethodChangeRecordService epsMethodChangeRecordService;

    /**
     * 查询收益方式修改记录列表
     */
    @RequiresPermissions("system:record:list")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody EpsMethodChangeRecord epsMethodChangeRecord)
    {
        PageDomain pageDomain = new PageDomain();
        pageDomain.setPageNum(epsMethodChangeRecord.getPageNum());
        pageDomain.setPageSize(epsMethodChangeRecord.getPageSize());
        startPage(pageDomain);
        List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
        return getDataTable(list);
    }

    /**
     * 导出收益方式修改记录列表
     */
    @RequiresPermissions("system:record:export")
    @Log(title = "收益方式修改记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, @RequestBody EpsMethodChangeRecord epsMethodChangeRecord)
    {
        List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
        ExcelUtil<EpsMethodChangeRecord> util = new ExcelUtil<EpsMethodChangeRecord>(EpsMethodChangeRecord.class);
        util.showColumn(epsMethodChangeRecord.getProperties());
        util.exportExcel(response, list, "收益方式修改记录数据");
    }

}