package com.tongran.system.controller;

import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsMethodChangeRecord;
import com.tongran.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 tongran
 * @date 2025-08-19
 */
@RestController
@RequestMapping("/record")
@RequiresPermissions("system:record")
public class EpsMethodChangeRecordController extends BaseController
{
    @Autowired
    private IEpsMethodChangeRecordService epsMethodChangeRecordService;

    /**
     * 查询收益方式修改记录列表
     */
    @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);
    }

    /**
     * 导出收益方式修改记录列表
     */
    @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, "收益方式修改记录数据");
    }

}