package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.common.log.annotation.Log;
import com.usky.common.log.enums.BusinessType;
import com.usky.fire.domain.PatrolInspectionEvent;
import com.usky.fire.domain.PatrolInspectionPlan;
import com.usky.fire.service.PatrolInspectionEventService;
import com.usky.fire.service.PatrolInspectionPlanService;
import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 事件管理表 前端控制器
 * </p>
 *
 * @author han
 * @since 2024-05-09
 */
@RestController
@RequestMapping("/patrolInspectionEvent")
public class PatrolInspectionEventController {
    @Autowired
    private PatrolInspectionEventService patrolInspectionEventService;

    /**
     * 列表
     * @param requestVO
     * @return
     */
    @PostMapping("patrolInspectionEventList")
    public ApiResult<CommonPage<PatrolInspectionEvent>> patrolInspectionEventList(@RequestBody PatrolInspectionPlanRequestVO requestVO){
        return ApiResult.success(patrolInspectionEventService.patrolInspectionEventList(requestVO));
    }

    /**
     * 新增
     * @param patrolInspectionEvent
     * @return
     */
    @Log(title = "事件管理", businessType = BusinessType.INSERT)
    @PostMapping("add")
    public ApiResult<Void> add(@RequestBody PatrolInspectionEvent patrolInspectionEvent){
        patrolInspectionEventService.add(patrolInspectionEvent);
        return ApiResult.success();
    }

    /**
     * 修改
     * @param patrolInspectionEvent
     * @return
     */
    @Log(title = "事件管理", businessType = BusinessType.UPDATE)
    @PutMapping("edit")
    public ApiResult<Void> edit(@RequestBody PatrolInspectionEvent patrolInspectionEvent){
        patrolInspectionEventService.edit(patrolInspectionEvent);
        return ApiResult.success();
    }
}

