package com.njzscloud.supervisory.biz.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.biz.pojo.entity.BizPatrolReportEntity;
import com.njzscloud.supervisory.biz.pojo.param.SearchBizPatrolReportParam;
import com.njzscloud.supervisory.biz.service.BizPatrolReportService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 巡查上报
 * @author ljw
 */
@Slf4j
@RestController
@RequestMapping("/biz_patrol_report")
@RequiredArgsConstructor
public class BizPatrolReportController {

    private final BizPatrolReportService bizPatrolReportService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody BizPatrolReportEntity entity) {
        bizPatrolReportService.add(entity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody BizPatrolReportEntity entity) {
        bizPatrolReportService.modify(entity);
        return R.success();
    }

    /**
     * 删除
     */
    @GetMapping("/remove")
    public R<?> remove(@RequestParam Long id) {
        bizPatrolReportService.remove(id);
        return R.success();
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<BizPatrolReportEntity> detail(@RequestParam Long id) {
        return R.success(bizPatrolReportService.detail(id));
    }

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<BizPatrolReportEntity>> paging(PageParam pageParam, SearchBizPatrolReportParam searchParam) {
        return R.success(bizPatrolReportService.paging(pageParam, searchParam));
    }

}
