package cn.cecep.talroad.controller.analysis;

import cn.cecep.talroad.common.core.utils.poi.ExcelUtil;
import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.common.log.annotation.Log;
import cn.cecep.talroad.common.log.enums.BusinessType;
import cn.cecep.talroad.service.analysis.SRaPollManTypeChangeService;
import cn.cecep.talroad.vo.analysis.SRaPollManTypeChangeVo;
import cn.cecep.talroad.vo.query.analysis.SRaPollManTypeChangeQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
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_poll_man_type_change)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/pollManTypeChange")
@Api(tags = "排污许可管理级别变化统计")
public class SRaPollManTypeChangeController {
    /**
    * 服务对象
    */
    @Resource
    private SRaPollManTypeChangeService service;

    /**
    * 查询列表
    *
    * @param query 查询条件
    * @return 列表数据
    */
    @GetMapping("selectList")
    @ApiOperation(value = "查询排污许可管理级别变化统计列表")
    public AjaxResults<IPage<SRaPollManTypeChangeVo>> selectList(SRaPollManTypeChangeQuery query) {
    return AjaxResults.success(service.selectList(query));
    }
    /**
     * 导出列表
     *
     * @param query 查询条件
     * @return 列表数据
     */
    @PostMapping("exportList")
    @Log(title = "导出排污许可管理级别变化统计",businessType = BusinessType.EXPORT)
    @ApiOperation(value = "导出排污许可管理级别变化统计")
    public void exportList(@RequestBody SRaPollManTypeChangeQuery query, HttpServletResponse response) {
        query.setPageNum(1);
        query.setPageSize(Integer.MAX_VALUE);
        List<SRaPollManTypeChangeVo> records = service.selectList(query).getRecords();
        ExcelUtil<SRaPollManTypeChangeVo> util=new ExcelUtil<>(SRaPollManTypeChangeVo.class);
        util.exportExcel(response,records,"导出排污许可管理级别变化统计");
    }
    /**
     * 查询列表
     *
     * @param query 查询条件
     * @return 列表数据
     */
    @GetMapping("selectIndustryPermissionNameList")
    @ApiOperation(value = "查询行业类别列表")
    public AjaxResults<List<String>> selectIndustryPermissionNameList(SRaPollManTypeChangeQuery query) {
        return AjaxResults.success(service.selectIndustryPermissionNameList(query));
    }
}
