package com.fs.company.controller;

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.domain.R;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.company.domain.CompanyTrafficRecordLog;
import com.fs.company.param.CompanyTrafficRecordLogQueryParam;
import com.fs.company.service.ICompanyTrafficRecordLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/company/trafficLog")
public class CompanyTrafficLogController extends BaseController {

    @Autowired
    private ICompanyTrafficRecordLogService companyTrafficRecordLogService;


    /** 流量充值记录查询 */
    @PreAuthorize("@ss.hasPermi('company:trafficLog:list')")
    @GetMapping(value = "/list")
    public TableDataInfo list(CompanyTrafficRecordLogQueryParam param) {
        startPage();
        List<CompanyTrafficRecordLog> list = companyTrafficRecordLogService.selectList(param);
        return getDataTable(list);
    }


    /** 导出 */
    @PreAuthorize("@ss.hasPermi('company:trafficLog:export')")
    @Log(title = "流量充值记录导出", businessType = BusinessType.EXPORT)
    @GetMapping(value = "/export")
    public AjaxResult export(CompanyTrafficRecordLogQueryParam param) {
        List<CompanyTrafficRecordLog> list = companyTrafficRecordLogService.selectList(param);
        ExcelUtil<CompanyTrafficRecordLog> util = new ExcelUtil<>(CompanyTrafficRecordLog.class);
        return util.exportExcel(list, "流量充值记录");
    }



}
