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.DataJinganAnalysis;
import com.usky.fire.service.DataJinganAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 静安电子督察单数据 前端控制器
 * </p>
 *
 * @author han
 * @since 2024-03-07
 */
@RestController
@RequestMapping("/dataJinganAnalysis")
public class DataJinganAnalysisController {
    @Autowired
    private DataJinganAnalysisService dataJinganAnalysisService;

    /**
     * 电子督察单管理-电子督察单列表查询
     *
     * @param startTime  开始时间
     * @param endTime  结束时间
     * @param superviseCode  督察单编号
     * @param id  主键ID
     * @param handleStatus  处理状态
     * @param pageNum      当前页
     * @param pageSize     每页条数
     * @return
     */
    @GetMapping("analysisList")
    public ApiResult<CommonPage<DataJinganAnalysis>> analysisList(@RequestParam(value = "startTime", required = false) String startTime,
                                                                  @RequestParam(value = "endTime", required = false) String endTime,
                                                                  @RequestParam(value = "superviseCode", required = false) String superviseCode,
                                                                  @RequestParam(value = "id", required = false) Integer id,
                                                                  @RequestParam(value = "handleStatus", required = false) Integer handleStatus,
                                                                  @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                                  @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
        return ApiResult.success(dataJinganAnalysisService.analysisList(startTime,endTime,superviseCode,id, handleStatus,pageNum, pageSize));
    }

    /**
     * 修改
     * @param dataJinganAnalysis
     * @return
     */
    @PutMapping
    public ApiResult<Void> update(@RequestBody DataJinganAnalysis dataJinganAnalysis){
        dataJinganAnalysisService.update(dataJinganAnalysis);
        return ApiResult.success();
    }
}

