package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.fire.domain.BaseGgpFacility;
import com.usky.fire.domain.DemReportInfo;
import com.usky.fire.domain.ReportResult;
import com.usky.fire.service.DemReportInfoService;
import com.usky.fire.service.ReportResultService;
import com.usky.fire.service.vo.BaseGgpFacilityVO;
import com.usky.fire.service.vo.ReportResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 报告结果表 前端控制器
 * </p>
 *
 * @author han
 * @since 2023-06-28
 */
@RestController
@RequestMapping("/reportResult")
public class ReportResultController {
    @Autowired
    private ReportResultService reportResultService;

    /**
     * 消防报告-历史报告列表查询
     *
     * @param companyId  单位ID
     * @param sourceType  来源类型
     * @param pageNum      当前页
     * @param pageSize     每页条数
     * @return
     */
    @GetMapping("reportResultList")
    public ApiResult<CommonPage<ReportResult>> reportResultList(@RequestParam(value = "companyId", required = false) Integer companyId,
                                                              @RequestParam(value = "sourceType", required = false) String sourceType,
                                                              @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                              @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
        return ApiResult.success(reportResultService.reportResultList(companyId,sourceType,pageNum, pageSize));
    }
    /**
     * 报告结果-查询
     *
     * @param reportObject  报告对象
     * @param pageNum      当前页
     * @param pageSize     每页条数
     * @return
     */
    @GetMapping("newReportResultList")
    public ApiResult<CommonPage<Object>> newReportResultList(@RequestParam(value = "reportObject", required = false) String reportObject,
                                                     @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                     @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
        return ApiResult.success(reportResultService.newReportResultList(reportObject,pageNum, pageSize));
    }
}

