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

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author han
 * @since 2024-03-07
 */
@RestController
@RequestMapping("/dataJinganPerson")
public class DataJinganPersonController {
    @Autowired
    private DataJinganPersonService dataJinganPersonService;

    /**
     * 人工督察单管理-人工督察单列表查询
     *
     * @param startTime  开始时间
     * @param endTime  结束时间
     * @param artificialCode  督察单编号
     * @param id  主键ID
     * @param handleStatus  处理状态
     * @param pageNum      当前页
     * @param pageSize     每页条数
     * @return
     */
    @GetMapping("personList")
    public ApiResult<CommonPage<DataJinganPerson>> personList(@RequestParam(value = "startTime", required = false) String startTime,
                                                              @RequestParam(value = "endTime", required = false) String endTime,
                                                              @RequestParam(value = "artificialCode", required = false) String artificialCode,
                                                              @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(dataJinganPersonService.personList(startTime,endTime,artificialCode,id,handleStatus,
                pageNum, pageSize));
    }

    /**
     * 修改
     * @param dataJinganPerson
     * @return
     */
    @PutMapping
    public ApiResult<Void> update(@RequestBody DataJinganPerson dataJinganPerson){
        dataJinganPersonService.update(dataJinganPerson);
        return ApiResult.success();
    }
}

