package com.sundot.airport.web.controller.ledger;

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

import com.sundot.airport.common.annotation.Log;
import com.sundot.airport.common.core.controller.BaseController;
import com.sundot.airport.common.core.domain.AjaxResult;
import com.sundot.airport.common.core.page.TableDataInfo;
import com.sundot.airport.common.enums.BusinessType;
import com.sundot.airport.common.utils.poi.ExcelUtil;
import com.sundot.airport.ledger.domain.LedgerSeizureStats;
import com.sundot.airport.ledger.service.ILedgerSeizureStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 查获违规品统计Controller
 */
@RestController
@RequestMapping("/ledger/seizureStats")
public class LedgerSeizureStatsController extends BaseController {

    @Autowired
    private ILedgerSeizureStatsService service;

    @PreAuthorize("@ss.hasPermi('ledger:seizureStats:list')")
    @GetMapping("/list")
    public TableDataInfo list(LedgerSeizureStats query) {
        startPage();
        List<LedgerSeizureStats> list = service.selectList(query);
        return getDataTable(list);
    }

    @PreAuthorize("@ss.hasPermi('ledger:seizureStats:export')")
    @Log(title = "查获违规品统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LedgerSeizureStats query) {
        List<LedgerSeizureStats> list = service.selectList(query);
        ExcelUtil<LedgerSeizureStats> util = new ExcelUtil<>(LedgerSeizureStats.class);
        util.exportExcel(response, list, "查获违规品统计");
    }

    @PreAuthorize("@ss.hasPermi('ledger:seizureStats:query')")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable Long id) {
        return AjaxResult.success(service.getById(id));
    }
}
