package com.goldenwater.web.controller.yjjt;

import com.goldenwater.common.annotation.Log;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.common.core.page.TableDataInfo;
import com.goldenwater.common.enums.BusinessType;
import com.goldenwater.common.utils.poi.ExcelUtil;
import com.goldenwater.yjjt.domain.YjjtQuebaoStatistics;
import com.goldenwater.yjjt.service.IYjjtQuebaoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 站点缺报统计Controller
 */
@RestController
@RequestMapping("/yjjt/quebao")
@Tag(name = "站点缺报统计", description = "站点缺报统计接口")
public class YjjtQuebaoController extends BaseController {

    @Resource
    private IYjjtQuebaoService yjjtQuebaoService;

    /**
     * 查询站点缺报列表
     */
    @GetMapping("/list")
    @Operation(summary = "站点缺报列表", description = "查询站点缺报数据列表")
    @PreAuthorize("@ss.hasPermi('yjjtgl:quebaotongji:list')")
    public TableDataInfo list(YjjtQuebaoStatistics query) {
        startPage();
        List<YjjtQuebaoStatistics> list = yjjtQuebaoService.selectQuebaoStationList(query);
        return getDataTable(list);
    }

    /**
     * 导出站点缺报数据
     */
    @Log(title = "站点缺报导出", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    @Operation(summary = "导出站点缺报", description = "导出站点缺报数据")
    @PreAuthorize("@ss.hasPermi('yjjtgl:quebaotongji:export')")
    public void export(HttpServletResponse response, YjjtQuebaoStatistics query) {
        List<YjjtQuebaoStatistics> list = yjjtQuebaoService.selectQuebaoStationListForExport(query);
        ExcelUtil<YjjtQuebaoStatistics> util = new ExcelUtil<>(YjjtQuebaoStatistics.class);
        util.exportExcel(response, list, "站点缺报统计数据");
    }
}
