package com.jd.lightapplication.controller;

import com.jd.lightapplication.common.lang.R;
import com.jd.lightapplication.model.InspectionResult;
import com.jd.lightapplication.service.InspectionResultService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import javax.annotation.Resource;


@Slf4j
@RestController()
@RequestMapping("/api/inspection/result")
@Api(tags="巡检结果表")
public class InspectionResultController {

    @Resource
    private InspectionResultService inspectionResultService;

    @GetMapping("/list")
    @ApiOperation(value = "1、分页查询")
    public R queryPageBean(Page page) {
        return R.success(inspectionResultService.page(page));
    }

    @PostMapping("/addBean")
    @ApiOperation(value = "2、新增")
    public R addBean(@RequestBody InspectionResult inspectionResult) {
        inspectionResultService.save(inspectionResult);
        return R.success();
    }

    @PostMapping("/updateBean")
    @ApiOperation(value = "3、修改")
    public R updateBean(@RequestBody InspectionResult inspectionResult) {
        inspectionResultService.updateById(inspectionResult);
        return R.success();
    }

    @PostMapping("/deleteById")
    @ApiOperation(value = "4、删除")
    public R deleteById(long id) {
        inspectionResultService.removeById(id);
        return R.success();
    }

}