package cn.cecep.talroad.controller.analysis;

import cn.cecep.talroad.common.core.utils.poi.ExcelUtil;
import cn.cecep.talroad.common.log.annotation.Log;
import cn.cecep.talroad.common.log.enums.BusinessType;
import cn.cecep.talroad.domain.analysis.SRaLowMonitoringWater;
import cn.cecep.talroad.service.analysis.SRaLowMonitoringWaterService;
import cn.cecep.talroad.vo.query.analysis.SRaLowMonitoringQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

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

/**
* (s_ra_low_monitoring_water)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/lowMonitoringWater")
@Api(tags = "执法监测数据查询-废水数据查询",value = "废水数据查询")
public class SRaLowMonitoringWaterController {
        /**
        * 服务对象
        */
        @Resource
        private SRaLowMonitoringWaterService service;

    /**
     * 查询列表
     */
    @ApiOperation("查询废水数据列表")
    @GetMapping("/list")
    public IPage<SRaLowMonitoringWater> list(SRaLowMonitoringQuery param){
        Page<SRaLowMonitoringWater> page = new Page<>(param.getPageNum(),param.getPageSize());
        return service.page(page,SRaLowMonitoringQuery.createGasWrapper(param,SRaLowMonitoringWater.class));
    }
    /**
     * 查询列表
     */
    @ApiOperation("导出废水数据")
    @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, @RequestBody SRaLowMonitoringQuery param){
        List<SRaLowMonitoringWater> list = service.list(SRaLowMonitoringQuery.createGasWrapper(param,SRaLowMonitoringWater.class));
        ExcelUtil<SRaLowMonitoringWater> util = new ExcelUtil<>(SRaLowMonitoringWater.class);
        util.exportExcel(response, list, "导出废水数据");
    }

}
